语言

ListView.CheckedIndexCollection.IndexOf(Int32) 方法

定义

从ListView.CheckedIndexCollection列表视图控件返回指定索引内的ListView.ListViewItemCollection索引。

public:
 int IndexOf(int checkedIndex);
public int IndexOf(int checkedIndex);
member this.IndexOf : int -> int
Public Function IndexOf (checkedIndex As Integer) As Integer

参数

checkedIndex
Int32

集合中要查找的 ListView.ListViewItemCollection 从零开始的索引。

返回

集合中指定索引所在的ListView.ListViewItemCollection集合中从零开始的索引ListView.CheckedIndexCollection;否则,如果索引不在集合中,则 -1。

注解

一旦知道某个项位于选中的索引集合中(使用 Contains 该方法),就可以使用 IndexOf 该方法来确定索引在中的 ListView.CheckedIndexCollection位置。

适用于

另请参阅