代码如下,不过好象少很多,那位高手帮帮忙,或谁有这样的原代码呀,我们要交作业.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, FileCtrl, StdCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
Panel7: TPanel;
Panel8: TPanel;
FileListBox1: TFileListBox;
Image1: TImage;
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
Img:TImage;
implementation{$R *.dfm}
procedure Showimage;
var i,j,k:integer;begin
if i>=1 then
for j:=1 to i do
begin
if Assigned(img[j]) then
begin
img[j].Free;
img[j]:=nil;
end;
if Assigned(Nam[j]) then
begin
Nam[j].Free;
Nam[j]:=nil;
end;
if Assigned(Bak[j]) then
begin
Bak[j].Free;
Bak[j]:=nil;
end;
if Assigned(Red[j]) then
begin
Red[j].Free;
Red[j]:=nil;
end;
end;
for j:=1 to i do
begin
img[j]:=Timage.Create(self);
img[j].Visible:=True;
img[j].Stretch:=True;
//动态创建图象实例 Nam[j]:=TLable.Create(self);
Nam[j].Font.Color:=clBlue;
//动态创建标记 Red[j]:=Tpanel.Create(self);
Bak[j]:=Tpanel.Create(self);
//Red为底版,Bak为状态字 Ima[j].Parent:=Red[j];
Bak[j].Rarent:=Red[j];
Nam[j].Parent:=Bak[j];
Bak[j].BevelOuter:=bvLowerde; Bak[j].Font.Size:=9;
Bak[j].Color:=clBlue;
Red[j].Rarent:=Panel2;
Red[j].Visible:=True;
Red[j].Width:=104;
Red[j].Height:=118; Nam[j].Width:=100;
ima[j].Width:=98;
Ima[j].Height:=98;
Bak[j].Width:=100;
Bak[j].Height:=12; path:=FileListBox1.Dirctory+'\'+fileListBox1.Items.Strings[j-1];
Ima[j].Picture.LoadFromFile(Path);
Ima[j].Center:=True;
Nam[j].Caption:=FileListBox1.Items.Strings[j-1]; Bak[j].OnMouseMove:=Panel2.OnMouseMove;
Bak[j].OnClick:=Panel2.OnClick;
Bak[j].OnDbclick:=Panel2.OnDblick;
Img[j].OnMouseMove:=Panel2.OnMouseMove;
Img[j].OnClick:=Panel2.OnClick;
Img[j].OnDbclick:=Panel2.OnDblick; if (j>=1) and (j<=6) then
begin
if (j=1) then
begin
Red[j].Top:=10;
Red[j].Left:=10;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].Visible:=True;
end;
if (j>=2)and(j<=6) then
begin
Red[j].Top:=Red[j-1].Top;
Red[j].Left:=Red[j-1].Left+110;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].Visible:=True;
end;
end;
else
begin
k:=Trunc(j/6);
if ((j mod(k*6))=1) then
begin
if k=1 then
Red[j].Top:=110*k+20;
else
Red[j].Top:=120*k+10; Red[j].Left:=10;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].visible:=true;
end;
else
begin
Red[j].Top:=Red[j-1].Top;
Red[j].Left:=Red[j-1].Left+110;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].visible:=true;
end;
end;
Bak[j].Top:=Img[j].Top+101;
Bak[j].Left:=2; Bak[j].Caption:=inttostr(Img[j].Picture.Width)+'x'+inttostr(Img[j].Picture.Height);
Nam[j].Visible:=False;
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, FileCtrl, StdCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
Panel7: TPanel;
Panel8: TPanel;
FileListBox1: TFileListBox;
Image1: TImage;
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
Img:TImage;
implementation{$R *.dfm}
procedure Showimage;
var i,j,k:integer;begin
if i>=1 then
for j:=1 to i do
begin
if Assigned(img[j]) then
begin
img[j].Free;
img[j]:=nil;
end;
if Assigned(Nam[j]) then
begin
Nam[j].Free;
Nam[j]:=nil;
end;
if Assigned(Bak[j]) then
begin
Bak[j].Free;
Bak[j]:=nil;
end;
if Assigned(Red[j]) then
begin
Red[j].Free;
Red[j]:=nil;
end;
end;
for j:=1 to i do
begin
img[j]:=Timage.Create(self);
img[j].Visible:=True;
img[j].Stretch:=True;
//动态创建图象实例 Nam[j]:=TLable.Create(self);
Nam[j].Font.Color:=clBlue;
//动态创建标记 Red[j]:=Tpanel.Create(self);
Bak[j]:=Tpanel.Create(self);
//Red为底版,Bak为状态字 Ima[j].Parent:=Red[j];
Bak[j].Rarent:=Red[j];
Nam[j].Parent:=Bak[j];
Bak[j].BevelOuter:=bvLowerde; Bak[j].Font.Size:=9;
Bak[j].Color:=clBlue;
Red[j].Rarent:=Panel2;
Red[j].Visible:=True;
Red[j].Width:=104;
Red[j].Height:=118; Nam[j].Width:=100;
ima[j].Width:=98;
Ima[j].Height:=98;
Bak[j].Width:=100;
Bak[j].Height:=12; path:=FileListBox1.Dirctory+'\'+fileListBox1.Items.Strings[j-1];
Ima[j].Picture.LoadFromFile(Path);
Ima[j].Center:=True;
Nam[j].Caption:=FileListBox1.Items.Strings[j-1]; Bak[j].OnMouseMove:=Panel2.OnMouseMove;
Bak[j].OnClick:=Panel2.OnClick;
Bak[j].OnDbclick:=Panel2.OnDblick;
Img[j].OnMouseMove:=Panel2.OnMouseMove;
Img[j].OnClick:=Panel2.OnClick;
Img[j].OnDbclick:=Panel2.OnDblick; if (j>=1) and (j<=6) then
begin
if (j=1) then
begin
Red[j].Top:=10;
Red[j].Left:=10;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].Visible:=True;
end;
if (j>=2)and(j<=6) then
begin
Red[j].Top:=Red[j-1].Top;
Red[j].Left:=Red[j-1].Left+110;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].Visible:=True;
end;
end;
else
begin
k:=Trunc(j/6);
if ((j mod(k*6))=1) then
begin
if k=1 then
Red[j].Top:=110*k+20;
else
Red[j].Top:=120*k+10; Red[j].Left:=10;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].visible:=true;
end;
else
begin
Red[j].Top:=Red[j-1].Top;
Red[j].Left:=Red[j-1].Left+110;
Img[j].Top:=3;
Img[j].Left:=3;
Img[j].visible:=true;
end;
end;
Bak[j].Top:=Img[j].Top+101;
Bak[j].Left:=2; Bak[j].Caption:=inttostr(Img[j].Picture.Width)+'x'+inttostr(Img[j].Picture.Height);
Nam[j].Visible:=False;
end;end.
解决方案 »
- TTabSheet 动态删除 效果不理想??
- 请问如何处理--[Fatal Error] Ymcl.dpr(48): Internal error: URW3537
- 如何将一个整数转化位十六进制的数值,并按二进制数值方式写入注册表?
- 报表使用新手.为什么我的报表每页只显示一条记录。在线等 。
- 邮件发送的问题!
- 怎样读取由.aspx生成的xml文件?
- 怎样终止do while的运行
- 去掉共享!!
- 怎样将foxbase数据库中的数据导入access(或sql server)中
- 日期型变量如何相加,比如我想在1990-1-1上加上一个月或一天?
- 请问一个问题,在TREEVIEW中一个结点的TEXT我知道怎么设置,他是否还有个VALUE???怎么设置?
- 这就是我们的警察
看得晕.