请问listview的用法
怎么增加一项
怎么减去一项
怎么上下移动一项
怎么把多选的移动到另一个listview中去
请附源代码,验证正确后即给分。

解决方案 »

  1.   

    留下EMAIL,我给你发过去;这里也有;
    http://www.csdn.net/Dev/Delphi/Samples/
      

  2.   

    http://www.csdn.net/Dev/Delphi/Samples/tipexplr.zip
      

  3.   

    procedure TForm1.Btn_AddClick(Sender: TObject);
    var
      i:integer;
    begin
      for i:=1 to 10 do
        ListView1.AddItem('项'+IntToStr(i),nil);
    end;procedure TForm1.Btn_DeleteClick(Sender: TObject);
    begin
      if ListView1.Selected<>nil then
        ListView1.DeleteSelected;
    end;
      

  4.   

    暴简单哪……add delete移动自己写个程序 象交换变量一样交换 就可以啦dp的例子中有的
      

  5.   

    dp中没有说怎么删除啊,不过朝戈兄的删除可以了,请问
    增加一项怎么增加,需要用到subitems,再有怎么移动啊
    实现了即可给分了。
      

  6.   

    procedure TForm1.FormCreate(Sender: TObject);const
      Names: array[0..5, 0..1] ofstring = (
        ('Rubble', 'Barney'),
        ('Michael', 'Johnson'),
        ('Bunny', 'Bugs'),
        ('Silver', 'HiHo'),
        ('Simpson', 'Bart'),
        ('Squirrel', 'Rocky')
        );var
      I: Integer;
      NewColumn: TListColumn;
      ListItem: TListItem;
      ListView: TListView;
    begin
      ListView := TListView.Create(Self);
      with ListView do
      begin
        Parent := Self;
        Align := alClient;    ViewStyle := vsReport;    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;
    出自delphi的help
      

  7.   

    考,为什么这样会错呢??
    i:=1;
    left:=Listview1.left;
    top:=listview1.top;point.y:=listview1.Selected.top;
    point.x:=listview1.Selected.left;with Listview1 do
     begin
       while i<listview1.Columns.Count do
        begin
           Listitem:=listview1.GetNearestItem(point,sdright);
           //showmessage(inttostr(point.y));
           point.x:=listitem.Left;//这儿怎么会出错呢?简直冤枉啊~疯了~
           point.Y:=listitem.top;//这儿当然也会出错了啦~why????
           point.x:=point.x+left;
           point.y:=point.y+top;
           i:=i+1;
        end;
    end;我上面才想完成listview的遍历,着是copy的基础,看来着而我都出错,copy我无法实现了
    (除非你只考一个记录,但是这样没用)