ListView.SelectedListViewItemCollection.IndexOf(ListViewItem) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳指定項目集合內的索引。
public:
int IndexOf(System::Windows::Forms::ListViewItem ^ item);
public int IndexOf(System.Windows.Forms.ListViewItem item);
member this.IndexOf : System.Windows.Forms.ListViewItem -> int
Public Function IndexOf (item As ListViewItem) As Integer
參數
- item
- ListViewItem
收藏中要找到的物品。
傳回
集合中項目的零基索引。 若該項目不在集合中,則回傳 -1。
備註
一旦你知道某個項目在選取的項目集合中(使用該 Contains 方法),你就可以用該 IndexOf 方法來判斷該項目在 ListView.SelectedListViewItemCollection.