急啊。

解决方案 »

  1.   

    参见下面的帖子“在窗体上能同时显示多幅图像吗?”每行一幅图像,右对齐,图像之间纵向间距相同,增加的图像自动显示在窗体的最后一行,窗体上放不下时加卷滚条,可以选中每幅图像分别进行处理。还有一个问题,图像的大小可否不同?能用ListView吗?还是必须用Windows API?
      

  2.   

    用imageen控件可以解决问题。
    www.playicq.com有下载。
      

  3.   

    用Delphi的Timage控件就可以了,多幅的话,动态创建然后再用Scrollbox把他们包容起来!
      

  4.   

    怎么在scrollbox里选中单个图像呢?
      

  5.   

    选中图像和scrollbox没有什么关系吧,你在外面怎么选在scrollbox里还怎么选啊
      

  6.   

    在外面怎么选啊?listview有自己的method,难道我自己算坐标吗?
      

  7.   

    找到了一个thumbs.zip (在google 上搜索到的),正在看,好像可以作出这个功能,但还需要加很多东东。所以如果谁能快速作出一个原型,四本书仍然有效。
    期待。
      

  8.   

    不知是不是我理解错了,不然感觉很简单啊
    procedure TForm1.BitBtn1Click(Sender: TObject);
    var
       one:Timage;
       i,j:integer;
    begin
       j:=10;   for i:=1 to 10 do
       begin
         one:=Timage.Create(self);
         one.Picture.LoadFromFile('E:\图片\FB\'+inttostr(i)+'.jpg');
         one.AutoSize:=true;
         one.left:=200;
         one.Top :=j+10;
         one.Visible :=true;
         one.parent:=self;
         one.OnDblClick :=test;
         
         j:=j+one.height;
         one.Name :='image'+inttostr(i+1);
       end;
    end;procedure TForm1.test(Sender: TObject);
    begin
      //双击不同的图象框就进行不同的处理,这只是模拟
      showmessage((sender as Timage).name);
    end;
      

  9.   

    双击时报错。还有,让最后加入的图像是当前显示呢?怎么能处理Wheel Mouse中间按钮的事件?
      

  10.   

    AImage1[countImage] := TImage.Create(self);
       AImage1[countImage].Width := 160;
       AImage1[countImage].Height :=160;
       AImage1[countImage].Top :=10+ (countImage div n)*180;
       AImage1[countImage].Left := 10+ (countImage mod n)*180;
    ...
       AImage1[countImage].Tag := tag;
       AImage1[countImage].Stretch := true;
       AImage1[countImage].OnClick := Image1Click;
       AImage1[countImage].Picture.Bitmap.Assign(image.Picture.Bitmap);
       ScrollBox1.InsertControl(AImage1[countImage]);   ACheckBox1[countImage] := TCheckBox.Create(self);
       ACheckBox1[countImage].Checked := False;
       ACheckBox1[countImage].Caption := '图像'+inttostr(countImage+1);
       ACheckBox1[countImage].Top := AImage1[countImage].Top + 162;
       ACheckBox1[countImage].Left := AImage1[countImage].Left;
       ACheckBox1[countImage].Width := 160;
       ACheckBox1[countImage].Height := 17;
    ...
       ACheckBox1[countImage].Tag := tag;
       ACheckBox1[countImage].OnClick := CheckBox1Click;
       ScrollBox1.InsertControl(ACheckBox1[countImage]);
      

  11.   

    不知你的当前显示是何意
    鼠标中键和右键的效果很容易解决,我刚才已经测试通过了
    我不知道你为什么双击会出错,这是我测试通过的代码
    有问题发邮件到 [email protected]
    祝你好运
      

  12.   

    来自:toplor, 时间:2002-7-8 9:07:00, ID:1192685
    创建像ACDSee那样的缩略图浏览器,这并不是一件简单的事。以下就是一个很原始的缩略图控件的源代码:uses jpegtype 
      tbi_thumb=class(tcustomcontrol)
        fmypic : tjpegimage;
      private
        procedure getpic(value:tjpegimage);
      public
        procedure paint; override;
        constructor create(aowner:tcomponent); override;
        destructor destroy; override;
      published
        property pic:tjpegimage write getpic;
    end;constructor tbi_thumb.create(aowner:tcomponent);
    begin
      inherited;
      fmypic:=tjpegimage.create;
    end;destructor tbi_thumb.destroy;
    begin
      inherited;
      fmypic.free;
    end;procedure tbi_thumb.getpic(value:tjpegimage);
    begin
      fmypic.scale:=jshalf;
      fmypic.assign(value);
      fmypic.dibneeded;
    end;procedure tbi_thumb.paint;
    var 
      arect : trect;
      ratio : single;
    begin
      arect:=clientrect;
      canvas.stretchdraw(arect,fmypic);
      frame3d(canvas,arect,clblack,clwhite,2);
    end;(这不是一个可视控件。)下面来实现新建一个Form,并在其上添加一个Directory List Box和一个Scrollbox,其中Scrollbox的宽度(Width)大约为430个象素。
    当用户选定了一个新的目录,我们需要扫描这个目录,为其中每一个JPEG文件创建一个实例。为了加快这一过程的速度,可以将JPEG参数设为jpbestspeed。JPEG文件将被读入一个临时缓冲区,然后被赋值给一个新的缩略图对象的pic属性。在unit中添加一个新的变量:
    var 
      buffer_jpeg:tjpegimage;下面的代码用来创建和释放buffer_jpeg变量:procedure TForm1.FormCreate(Sender: TObject);
    begin
      buffer_jpeg:=tjpegimage.create;
      buffer_jpeg.Performance:=jpbestspeed;
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
      buffer_jpeg.free;
      while scrollbox1.ComponentCount>0 do
      scrollbox1.components[0].free;
    end;以下的代码在文件夹中检索JPEG文件并创建缩略图:procedure TForm1.DirectoryListBox1Change(Sender: TObject);
    var 
      i,x,y : integer;
      anewthumb : tbi_thumb;
      foundlist : tstringlist;
      sr : TSearchRec;begin
      foundlist:=tstringlist.create;  try
        //检索JPEG文件
        if FindFirst(directorylistbox1.Directory+'\*.jpg', faAnyFile, sr) = 0 then
        begin
          foundlist.add(sr.name);
          while FindNext(sr) = 0 do
          foundlist.add(sr.name);
          FindClose(sr);
        end;    x:=0;
        y:=0;    //创建缩略图
        for i:=0 to FoundList.count-1 do
        begin
          anewthumb:=tbi_thumb.create(self);
          buffer_jpeg.loadfromfile(foundlist[i]);
          with anewthumb do 
          begin
            pic:=buffer_jpeg;
            parent:=scrollbox1;
            left:=x;
            top:=y;
            width:=120;
            height:=90;
            visible:=true;
            inc(x,122);
            if x>244 then
            begin 
              x:=0; 
              inc(y,92); 
            end;
            application.processmessages;
          end;
        end;  finally 
        foundlist.free; 
      end;end;以上就是一个极简单的缩略图浏览器实现,你可以继续在里面添加需要的功能。
      

  13.   

    下面是我改了一些,增加了单击显示功能,希望你能举一反三。。呵呵
    控件部分:unit mini;interface
    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, FileCtrl, jpeg, extctrls;
    type
      tbi_thumb = class(tcustomcontrol)
        fmypic: tjpegimage;  private
        procedure getpic(value: tjpegimage);
      public
        FileName: String;         //图片路径
        procedure paint; override;
        constructor create(aowner: tcomponent); override;
        destructor destroy; override;  published
        property pic: tjpegimage write getpic;
        property OnClick;         //继承单击事件
      end;
    implementation
    constructor tbi_thumb.create(aowner: tcomponent);
    begin
      inherited;
      fmypic := tjpegimage.create;
    end;destructor tbi_thumb.destroy;
    begin
      inherited;
      fmypic.free;
    end;procedure tbi_thumb.getpic(value: tjpegimage);
    begin
      fmypic.scale := jshalf;
      fmypic.assign(value);
      fmypic.dibneeded;
    end;
    procedure tbi_thumb.paint;
    var
      arect: trect;
      ratio: single;
    begin
      arect := clientrect;
      canvas.stretchdraw(arect, fmypic);
      frame3d(canvas, arect, clblack, clwhite, 2);
    end;end.窗体
    unit main;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, FileCtrl, jpeg;type
      TForm1 = class(TForm)
        DirectoryListBox1: TDirectoryListBox;
        DriveComboBox1: TDriveComboBox;
        ScrollBox1: TScrollBox;
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
        procedure DirectoryListBox1Change(Sender: TObject);
      private
        { Private declarations }
        procedure MyOnClickPic(Sender: TObject);       //动态创建事件
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementationuses mini, showpic;
    var
      buffer_jpeg: tjpegimage;
      //  anewthumb: Array of tbi_thumb;
      anewthumb: tbi_thumb;
    {$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
      buffer_jpeg := tjpegimage.create;
      buffer_jpeg.Performance := jpbestspeed;
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
      buffer_jpeg.free;
      while scrollbox1.ComponentCount > 0 do
        scrollbox1.components[0].free;end;procedure TForm1.DirectoryListBox1Change(Sender: TObject);
    var
      i, x, y: integer;  foundlist: tstringlist;
      sr: TSearchRec;begin
      foundlist := tstringlist.create;  try
        //检索JPEG文件
        if FindFirst(directorylistbox1.Directory + '\*.jpg', faAnyFile, sr) = 0 then
        begin
          foundlist.add(sr.name);
          while FindNext(sr) = 0 do
            foundlist.add(sr.name);      FindClose(sr);
        end;    x := 0;
        y := 0;    //创建缩略图
        for i := 0 to FoundList.count - 1 do
        begin
          anewthumb := tbi_thumb.create(self);
          anewthumb.OnClick := MyOnClickPic;     //把我的事件处理给onclick
          buffer_jpeg.loadfromfile(foundlist[i]);
          with anewthumb do
          begin
            FileName := foundlist[i];
            pic := buffer_jpeg;
            parent := scrollbox1;
            left := x;
            top := y;
            width := 120;
            height := 90;
            visible := true;
            inc(x, 122);
            if x > 366 then
            begin
              x := 0;
              inc(y, 92);
            end;
            application.processmessages;      end;
        end;  finally
        foundlist.free;
      end;end;procedure TForm1.MyOnClickPic(Sender: TObject);
    var
    s:string;
    begin
    s:=tbi_thumb(Sender).FileName;
    //  Showmessage(s);
     Form2.Image1.Picture.LoadFromFile(s);
     Form2.Show();
    end;end.