Listview的report模式操作

来源:互联网 发布:233什么意思网络语言 编辑:程序博客网 时间:2024/04/19 17:19

 ListView的vsReport模式可以添加多个columne,于是针对每个column的操作问题就成了个问题…… 下面直接帖出研究结论:    

1、使用ListView->Items->Add() 方法添加新的Item(即一行),返回值类型为
TListItem *,指向新添加的Item;
2、使用
listitem->Caption = "String",来向第一个column添加文字;
3、为了操作后续的column,需要使用subItems属性:
     
listitem->SubItems->Insert(0, "Johnny");
      listitem->SubItems->Insert(1, "Transfer Finished!");
      其中Insert方法中的第一个参数是Index,由于SubItem是从第二个column算起,所以0表示将插入第二column,1是第三column。
4、如果想更新已经插入过的column,只能先删除已有的,然后再用Insert方法,注意将Index算好就行了:
      listitem = ListView->Items->operator [](1) ;
      listitem->SubItems->Delete(0);
      listitem->SubItems->Insert(0, "Xiami");
      补充一下,ListView->Items->operator [](Index) 用于确定对第几个Item(第几行)操作,Index从0开始,返回类型也是
TListItem *。

原创粉丝点击