ListViewGroup

ListViewGroup表示ListView的分组。
通过ListView的Groups属性,可以增加、删除分组,或者获取指定名称的分组。

ListViewGroup的属性有:

示例

Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.CheckBoxes =
True '显示复选框
Dim
nms() As String = {"分组1","分组2","分组3"}
For
Each nm As String In nms '添加分组
   
Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
   
grp.Name = nm
   
grp.Text = nm 
Next
 
For
i As Integer = 0 To 9 '添加行
   
Dim vr As WinForm.ListViewRow = lvw.Rows.Add()
   
vr.text = "项目" & i 
    vr.Group = nms( i
Mod 3) '指定行所属的分组
Next
For Each
vr As WinForm.ListViewRow In lvw.Groups("分组1").Rows '勾选分组1中的所有行
   
vr.Checked = True
Next

 

 

 

 


本页地址:http://www.foxtable.com/webhelp/topics/2852.htm