往另外1个ListView中添加当前选中的项目

 
//往另外1个ListView中添加当前选中的项目
 
function AddSelItems(listview1:TListView;ListView2:TListView):Boolean;
var
  s: string;
  I: Integer;
begin
  Result:=False;
  if listview1.Selected =nil then  exit;
  for i := 0 to listview1.items.count - 1 do
  begin
    if listview1.items[i].selected then
       ListView2.Items.Add.Caption:=listView1.Items[i].Caption;
  end;
  Result:=True;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
     AddSelItems(ListView1,ListVIew2);
end;




原文地址:https://www.cnblogs.com/xe2011/p/3165379.html