代码如下,不过好象少很多,那位高手帮帮忙,或谁有这样的原代码呀,我们要交作业.
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.
解决方案 »
- == 请教:在FormCreate()中,如何中止释放该窗体 ?==
- 关于themeengine 5 组件的安装与使用的问题,会的青筋
- 请各位老师解答一下:我用edit控件作时间的输入框,可数据库中对应的字段都是日期型,问题就出来了,如何控制用户输入时不是非法的日期型字符
- 请教大家delphi调用sql2000事务的问题?
- 看着d5开发人员指南中写的“一个消息系统的剖析:VCL“我开始头大了!!
- indy 9装不了怎么办啊?
- delphi启动问题
- 急!!!我将工程另存为后,打开新工程名正常但一运行程序就提示:[Error] s .
- delphi xe5一般都装了 那个版本java?
- 我有两个问题,是使用MShtml时遇到的
- 请问一个问题,在TREEVIEW中一个结点的TEXT我知道怎么设置,他是否还有个VALUE???怎么设置?
- 这就是我们的警察
看得晕.