nbsp;Image1.Top:=(Panel1.Height-Image1.Height) div 2; Image1.Left:=(Panel1.Width-Image1.Width) div 2; end else begin Image1.Width:=Panel1.Width; Image1.Height:=Image1.Width*Image1.Picture.Bitmap.Height div Image1.Picture.Bitmap.Width; Image1.Top:=(Panel1.Height-Image1.Height) div 2; Image1.Left:=(Panel1.Width-Image1.Width) div 2; end; end else begin Image1.AutoSize:=false; Image1.Stretch:=true; if Image1.Picture.Bitmap.Height>=Image1.Picture.Bitmap.Width then begin Image1.Height:=Panel1.Height; Image1.Width:=Image1.Height*Image1.Picture.Bitmap.Width div Image1.Picture.Bitmap.Height; Image1.Top:=(Panel1.Height-Image1.Height) div 2; Image1.Left:=(Panel1.Width-Image1.Width) div 2; end else begin Image1.Width:=Panel1.Height; Image1.Height:=Image1.Width*Image1.Picture.Bitmap.Height div Image1.Picture.Bitmap.Width; Image1.Top:=(Panel1.Height-Image1.Height) div 2; Image1.Left:=(Panel1.Width-Image1.Width) div 2; end end; Image1.Visible:=true; end;
由于整个程序的代码比较长,上面仅列出了部分重要的代码。编译运行后的界面如图三所示。

(图三)
四.总结
利用delphi提供的ListView和ImageList控件我们基本实现了ACDSee的缩略图功能。但与ACDSee比起来我们的程序还差的很远,尤其是当某个目录下的图片文件较多时,速度会变得很慢。这方面还希望得到其他朋友的指点。源程序在delphi6.0和win98SE环境下编译通过,参考软件ACDSee3.0。
上一页 [1] [2] [3] [4] [5] [6] |