需要拖动TListView中的Item,于是在OnMouseDown事件中写下:
    ListView.BeginDrag(False, 1);
没想到就这么简单的操作竟然会出问题!!!只要把鼠标移到网线上,再拖动,竟然会把屏幕画得乱七八糟,哪位高手能解此问题???

解决方案 »

  1.   

    我这里没有这个问题,我用的是Delphi7,下面是我的代码:
    procedure TForm1.FormCreate(Sender: TObject);
    const
      Names: array[0..5, 0..1] of string = (
        ('Rubble', 'Barney'),
        ('Michael', 'Johnson'),
        ('Bunny', 'Bugs'),
        ('Silver', 'HiHo'),
        ('Simpson', 'Bart'),
        ('Squirrel', 'Rocky')
        );var
      I: Integer;
      NewColumn: TListColumn;
      ListItem: TListItem;
      ListView: TListView;
    begin
      with ListView1 do
      begin
        Parent := Self;
        Align := alClient;
        NewColumn := Columns.Add;
        NewColumn.Caption := 'Last';
        NewColumn := Columns.Add;
        NewColumn.Caption := 'First';    for I := Low(Names) to High(Names) do
        begin
          ListItem := Items.Add;
          ListItem.Caption := Names[I][0];
          ListItem.SubItems.Add(Names[I][1]);
        end;
      end;end;procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if(ListView1.Selected <> nil) then
        ListView1.BeginDrag(False, 1);
    end;
      

  2.   

    Sorry,忘说了,是在ViewStype=vsReport的情况下,绝对有问题,
    我都试了好几台电脑了,都是一样的!
      

  3.   

    呵呵:)
    我的没有哦
    D7Sp1+Win2003的http://lysoft.7u7.net
      

  4.   

    大家把鼠标移到所点项边界的地方,再拖动,一定会发现有问题没有问题,我的代码也只有一句
    ListView.BeginDrag(False, 1);
    楼主,帮不了你了
      

  5.   

    怎么可能没问题?大家仔细看看在vsReport下会有问题
      

  6.   

    我也试了,没问题,肯定是你的机器或你的delphi有问题