用ListView和ImageList实现了和acdsee98%相似的界面

TImage不是一个好主意,不妨用ListView和ImageList好些。
下面这段是我以前的一个程序中拷下来的,要做一些改动,但大概意思是这样。

procedure TListVThread.Execute;
var i,tw,th:integer; bitmap,map:tbitmap;arect,brect:trect;
begin
 with mybook do
 begin
 listview1.show;
 gauge1.Show;
 //label4.caption:='共'+inttostr(it);
 if not brdone then
 begin
 filelistbox1.mask:='*.bmp;*.jpg;*.jpeg;*.emf;*.wmf;*.psd;*.pdd;*.tif; *.tiff;*.fax;*.bw;*.rgb;*.rgba;*.sgi;*.cel; *.pic;*.tga; *.vst;*.icb; *.vda; *.win;*.pcx;*.pcc;*.scr;*.pcd;*.ppm;*.pgm;*.pbm;*.cut;*.pal;*.rla;*.rpf;*.rle;*.dib;*.psp;*.png';
 filelistbox1.Update;
 it:=filelistbox1.Items.Count;
 gauge1.MaxValue := it;
 listview1.Items.Clear;
 imagelist1.Clear;
 w:=imagelist1.Width;
  h:=imagelist1.height;
  arect.Left :=0;
  arect.Top :=0;
  arect.Right :=w;
  arect.Bottom :=h;
  brect:=arect;
  map := TBitmap.Create;
 for i:=1 to it do
 begin
 s:=filelistbox1.Items[i-1];
 image1.picture.LoadFromFile(s);
 tw:=image1.Picture.Width;
 th:=image1.Picture.height;
 Bitmap := TBitmap.Create;
 Clipboard.Assign(Image1.Picture);
 map.LoadFromClipBoardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
 bitmap.Width :=w;
 bitmap.height:=h;
 bitmap.Canvas.Rectangle(brect);
 if(tw<w)and(th<h) then
 bitmap.canvas.Draw(w div 2-tw div 2,h div 2-th div 2,map)
 else
 begin
 if tw>th then
  begin
  arect.left:=0;
  arect.Right:=w;
  tem:=round(w*(th/tw));
  arect.top:=(h-tem) div 2;
  arect.bottom:=arect.top+tem;
  end
 else
  begin
  arect.top:=0;
  tem:=round(h*(tw/th));
  arect.Left :=w div 2- tem div 2;
  arect.Right:=arect.left+tem;
  arect.bottom:=h;
  end;
 bitmap.Canvas.StretchDraw(arect,map)
 end;
 imagelist1.Add(bitmap,bitmap);
 listview1.Items.Add;
 pi:=i;
 synchronize(prog);
 //caption:='Isee '+inttostr(round(i/it*100))+'%';
 listview1.Items[i-1].imageindex:=i-1;
 listview1.Items[i-1].Caption:=s;
 end;
 caption:='Isee';
 //listview1.Cursor:=crdefault;
 gauge1.Hide;
 gauge1.Progress := 0;
 SpeedButton42.Enabled := false;
 SpeedButton43.Enabled := false;
 SpeedButton26.Enabled := true;
 brdone:=true;
 statusbar1.panels.items[1].text:='共打开'+inttostr(it)+'个文件 ';
 end;
 end;
end;  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值