代码如下,不过好象少很多,那位高手帮帮忙,或谁有这样的原代码呀,我们要交作业.
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.

解决方案 »

  1.   

    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
        procedure  Showimage;
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      Img:TImage;
    implementation{$R *.dfm}
    procedure  TForm1.Showimage;
    var  i,j,k:integer;
    ... ...
      

  2.   

    delphi 图片浏览 源代码下载:http://23644.playicq.com/1/21539.html
      

  3.   

    用Delphi实现图片浏览功能
    作者: 连仁包 在ACDSee中使用上下箭头键浏览图片一定使大家觉得很方便吧,在这里我用Delphi模拟这一功能,方法如下:首先,新建一个工程,在窗体上放置DirveCombobox控件、DirectorxListBox控件、FileListBox控件、 FilterCombox控件、Image控件各一个。在DirectoryListBox的FileList属性选择FileListBox1,在FilterComboBox的FileList属性选择FileListBox1,在DriveCombobox控件的Dirlist中选择DirectorylistBox1,修改Image的Center属性为True并调节适当的位置和大小。在FilterComBox的文件过滤器Filter属性中添加*.jpg、*.bmp,这里还可以添加其他的Image控件能识别的文件后缀。接下来就可添加代码了。双击FileListBox的onclick事件,添加如下代码:tryimage1.Picture.LoadFromFile(filelistbox1.FileName)exceptapplication.MessageBox('文件格式不对','提示',0);end;其中try...except语句是错误补捉语句,当文件的格式不对时,提示错误。现在按一下F9,现在可以用上下件浏览图片了!注意:如果发现Image控件不能读jpg格式的文件,可以先在Image控件的picture中指定一个jpg图像。本程序在Win98、Delphi5中通过。