TListView的用法(转载)

原文地址:http://www.cnblogs.com/sideandside/archive/2007/03/26/688707.html

 

TListView用法

1.TListView方法:

procedure Clear; override;  // 从列表控件中删除所有的项目

2.TListView属性:

property  Column[Index:  Integer ]: TListColumn; // 通过参数 Index 指明一列
property  Columns: TListColumns; // 记录列表中列的属性
property  Items: TListItems; // 包含列表中的所有项目Contains the list of items displayed by the list view. 


2.1TListItems属性:

TListItems.Clear
procedure Clear;
// 从列表中移去所有的项目Removes all items from the list.
TListItems.BeginUpdate
procedure BeginUpdate;
// 更新列表直到EndUpdate方法被调用
TListItems.Add
function  Add: TListItem; // 创建一个新的项目并添加到列表中

不要忘记BeginUpdate和EndUpdate是成对出现的

2.1.1TListItem属性:

TListItem.Caption
property  Caption:  string ; // 指定列表中项目的标签Specifies the text that labels the item in the list.
 

property  SubItems: TStrings; // 作为项目列表的子项目的任何字符串Contains any strings that appear  as  subitems  to  the list item.


2.1.1.1TStrings属性

function  Add( const  S:  string ):  Integer ; virtual; // 添加字符串到列表的末尾Adds a  string  at the  end  of the list.

 

3.层次关系:

TListView:
           
-> Columns:
           
-> Items  :  --> TListItems:   
                      
--> Clear:                        
                      
--> BeginUpdate:
                      
--> Add:       ---> TListItem:   ----> Caption:
                                                   
---->  SubItems: --> TStrings: -> Add
TListView:代表整个列表,所有的行和列的属性方法的集合
->Columns:所有列
->Items  :所有行,TListItems类型
       -->TListItems: 所有行即条目的属性方法的集合 
       -->Clear: 移除所有的条目                      
       -->BeginUpdate: 更新所有的条目
       -->Add: 添加新的条目 ,TListItem类型  
            --->TListItem: 一行或者条目的属性方法的集合
            --->Caption:一个条目的名称
            ---> SubItems:一个条目的子条目,TStrings类型
                   -->TStrings:一个字符串的集合
                        ->Add:添加一个字符串

你可能感兴趣的:(String,Integer)