D
del520
Unregistered / Unconfirmed
GUEST, unregistred user!
如题,执行结果是DBImage的数目是对的,刚好是多少个记录多少个图像,但图像都是同一副
unit imageBrow;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, StdCtrls;
type
TFImageBrow = class(TForm)
Procedure CreateImage(nLeft,nTop:integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FImageBrow: TFImageBrow;
implementation
uses Unit2, Unit1;
{$R *.dfm}
Procedure TFImageBrow.CreateImage(nLeft,nTop:integer);
var
aDbImage:TDbImage;
aLabel:TLabel;
aDbText:TDbText;
begin
//建立一个DbImage 来显示图像
aDbImage:=TDbImage.Create(self);
With aDbImage do
begin
Parent:=FImageBrow;
Left:=nLeft;
top:=nTop;
height:=96;
Width:=96;
Stretch:=True;
DataSource:=UserCard.DataSource1;
DataField:='相片';
end;
//建立一个Label值为姓名
aLabel:=TLabel.create(self);
aLabel.Parent:=FImageBrow;
aLabel.Left:=nLeft+2;
aLabel.Top:=ntop+98;
aLabel.Caption:='姓名:';
//建立一个DbText 显示对应的姓名
aDbTExt:=TDbTExt.Create(self);
aDbText.Left:=nLeft+34;
aDbText.Parent:=aLabel.parent;
aDbTExt.Top:=aLabel.Top;
aDbText.DataSource:=aDbImage.DataSource;
aDbText.DataField:='姓名';
end;
procedure TFImageBrow.FormCreate(Sender: TObject);
var
nHeight,nWidth,nTop,nLeft:Integer;
begin
nheight:=FImageBrow.Height;
nWidth:=FImageBrow.width;
ntop:=10;
nLeft:=10;
With UserCArd.adoTable1 do
begin
first;
While not Eof do
begin
CreateImage(nleft,ntop);
nLeft:=nLeft+106;
if nWidth-nLeft<10 then
begin
nLeft:=10;
nTop:=nTop+126;
end;
Next;
end; //while
end; //with
end;
end.
unit imageBrow;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, StdCtrls;
type
TFImageBrow = class(TForm)
Procedure CreateImage(nLeft,nTop:integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FImageBrow: TFImageBrow;
implementation
uses Unit2, Unit1;
{$R *.dfm}
Procedure TFImageBrow.CreateImage(nLeft,nTop:integer);
var
aDbImage:TDbImage;
aLabel:TLabel;
aDbText:TDbText;
begin
//建立一个DbImage 来显示图像
aDbImage:=TDbImage.Create(self);
With aDbImage do
begin
Parent:=FImageBrow;
Left:=nLeft;
top:=nTop;
height:=96;
Width:=96;
Stretch:=True;
DataSource:=UserCard.DataSource1;
DataField:='相片';
end;
//建立一个Label值为姓名
aLabel:=TLabel.create(self);
aLabel.Parent:=FImageBrow;
aLabel.Left:=nLeft+2;
aLabel.Top:=ntop+98;
aLabel.Caption:='姓名:';
//建立一个DbText 显示对应的姓名
aDbTExt:=TDbTExt.Create(self);
aDbText.Left:=nLeft+34;
aDbText.Parent:=aLabel.parent;
aDbTExt.Top:=aLabel.Top;
aDbText.DataSource:=aDbImage.DataSource;
aDbText.DataField:='姓名';
end;
procedure TFImageBrow.FormCreate(Sender: TObject);
var
nHeight,nWidth,nTop,nLeft:Integer;
begin
nheight:=FImageBrow.Height;
nWidth:=FImageBrow.width;
ntop:=10;
nLeft:=10;
With UserCArd.adoTable1 do
begin
first;
While not Eof do
begin
CreateImage(nleft,ntop);
nLeft:=nLeft+106;
if nWidth-nLeft<10 then
begin
nLeft:=10;
nTop:=nTop+126;
end;
Next;
end; //while
end; //with
end;
end.