ListViewItem.ListViewSubItemCollection 类

表示 ListViewItem 中储存的 ListViewItem.ListViewSubItem 对象的集合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Class ListViewSubItemCollection
    Implements IList, ICollection, IEnumerable
用法
Dim instance As ListViewSubItemCollection
public class ListViewSubItemCollection : IList, ICollection, IEnumerable
public ref class ListViewSubItemCollection : IList, ICollection, IEnumerable
public class ListViewSubItemCollection implements IList, ICollection, 
    IEnumerable
public class ListViewSubItemCollection implements IList, ICollection, 
    IEnumerable

备注

ListViewItem.ListViewSubItemCollection 存储 ListViewItem.ListViewSubItem 对象,该对象表示 ListView 控件中父级 ListViewItem 的子项。当在 ListView 控件的 Columns 属性中指定列以及当 ListView 控件的 View 属性设置为 Details 时,ListView 控件中只显示子项。ListViewItem.ListViewSubItemCollection 中的子项的顺序决定 ListView 控件中显示子项的列。

向集合中添加子项的方法有多种。Add 方法向集合中添加单个 ListViewItem.ListViewSubItem。要向集合中添加多个子项,请创建 ListViewItem.ListViewSubItem 对象的数组,并将其传递到 AddRange 方法。如果要在集合内的特定位置插入某个子项,可使用 Insert 方法。要移除子项,可使用 Remove 方法,或者如果您知道子项在集合中的位置,也可使用 RemoveAt 方法。Clear 方法使您可以从集合中移除所有子项,而不必使用 Remove 方法一次移除一个子项。

除了用于添加和移除子项的方法和属性以外,ListViewItem.ListViewSubItemCollection 还提供在集合内查找子项的方法。Contains 方法使您可以确定某 ListViewItem.ListViewSubItem 是否为集合的成员。知道子项位于集合中后,可以使用 IndexOf 方法来确定子项在集合中的位置。

继承层次结构

System.Object
  System.Windows.Forms.ListViewItem.ListViewSubItemCollection

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

ListViewItem.ListViewSubItemCollection 成员
System.Windows.Forms 命名空间
ListViewItem 类
ListViewItem.ListViewSubItem 类
ListView 类