請問各位大大,我要將listview顯示的縮圖加入到listview2,請問該如何做呢?
下面的function可以將listview的縮圖加到listview2但是全都顯示listview1第一張的圖片,但是檔名是確定的,只是顯示的圖片都是第一張。
function MoveLvItem(lvOrig,lvdest:TlistView;checked:boolean=false):string;
var i,j:integer;
itemlist:TObjectlist;
listitem,newlistitem:TListItem;
begin
ItemList:=TObjectList.Create(false);
if not checked then
begin
for i:=lvOrig.Selected.Index to lvOrig.Items.Count -1 do
begin
if lvorig.Items[i].Selected then ItemList.Add(lvorig.Items[i]);
end;
end
else
begin
for i:=0 to lvorig.Items.Count -1 do
begin
if lvorig.Items[i].Checked then itemlist.Add(lvorig.Items[i]);
end;
end;
for i:=0 to itemlist.Count -1 do
begin
listitem:=itemList[i] as TlistItem;
newlistitem:= lvdest.Items.Add;
newlistitem.Caption:=listitem.Caption;
for j:= 0 to listitem.SubItems.Count -1 do
begin
newlistitem.SubItems.Add(listitem.SubItems[j]);
end;
end;
result:=(itemList[0] as TListItem).Caption;
(ItemList[0] as TlistItem).Delete;
for i:= 1 to ItemList.Count -1 do
begin
result:=Result +','+(Itemlist[-1] as TListItem).Caption;
(ItemList[1] as TListItem).Delete;
end;
ItemList.Free;
end;