本帖最后由 wudiralfzt2008 于 2009-06-23 17:40:40 编辑

解决方案 »

  1.   

    rect := Listview1.items[0].DisplayRect(drBounds);//运行过这句就出错 你运行时 listview1里就有数据了?
    可能是不存在这个对象导致的.
      

  2.   


    procedure TForm1.ListView2DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    begin
      Accept := True;
    end;procedure TForm1.ListView2DragDrop(Sender, Source: TObject; X, Y: Integer);
    var
      i:integer;
    begin
      if Source = ListView1 then
      begin
        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;
      end;
    end;