用ListView和ImageList实现了和acdsee98%相似的界面
来源:互联网 发布:ubuntu网卡重启命令 编辑:程序博客网 时间:2024/05/16 19:27
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;
下面这段是我以前的一个程序中拷下来的,要做一些改动,但大概意思是这样。
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;
- 用ListView和ImageList实现了和acdsee98%相似的界面
- ListView和ImageList的结合使用
- C#中ListView和ImageList配合使用
- WPF做了一个界面 感觉和WINFORM还是有很多相似之处的
- ListView之聊天界面的实现和ListView的动态改变布局
- android弹出了单选框和listview实现功能的问题
- XE8里面的ImageList和Box2D新特性
- Delphi中GDI+和ImageList使用的正确姿势
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- Android之ListView列表视图和界面跳转实现
- ListView实现下拉刷新(第一次打开listView的界面进行自动刷新)和上拉加载更多
- Jackcard相似度和余弦相似度(向量空间模型)的java实现
- Jackcard相似度和余弦相似度(向量空间模型)的java实现
- Listview的convertView机制和ViewHolder机制与西游记的相似之处
- C# 复选列表框 和 imageList组件
- 将sql server中的数据倒入Excel(c#)
- 在 Java 的泛型类型中使用通配符
- 对自己的话
- C++调用C函数问题
- 电夏end
- 用ListView和ImageList实现了和acdsee98%相似的界面
- 今天去看了看招聘会
- 几个宣传标语
- 恐怖分子在广州!(纯搞笑,娱乐一下,我想广州也不会这么夸张)
- 论兔子如何吃掉狼
- VB调用.Net编写的DLL组件示例
- 水晶报表注册码
- 我认为的歌坛振兴之道
- 关于考研~