ListView.CheckedIndexCollection 類別

定義

表示包含清單檢視控制項中所核取項目索引的集合。

public: ref class ListView::CheckedIndexCollection : System::Collections::IList
public class ListView.CheckedIndexCollection : System.Collections.IList
[System.ComponentModel.ListBindable(false)]
public class ListView.CheckedIndexCollection : System.Collections.IList
type ListView.CheckedIndexCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
[<System.ComponentModel.ListBindable(false)>]
type ListView.CheckedIndexCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ListView.CheckedIndexCollection
Implements IList
繼承
ListView.CheckedIndexCollection
屬性
實作

備註

會將 ListView.CheckedIndexCollection 索引儲存至 控制項中 ListView 已核取的專案。 只有當 控制項的 ListView 屬性設定 true 為 時, CheckBoxes 才能檢查項目。 中儲存 ListView.CheckedIndexCollection 的索引是 中的 ListView.ListViewItemCollection 索引位置。 會 ListView.ListViewItemCollection 儲存控制項中顯示的 ListView 所有專案。

下表是範例,說明 如何將 ListView.ListViewItemCollection 的專案 ListView 及其檢查狀態儲存在範例 ListView 控制項中。

索引 Item ListView 中的已核取狀態
0 Item1 未核取
1 Item2 已檢查
2 Item3 未核取
3 Item4 已檢查
4 Item5 已檢查

下表根據 ListView.ListViewItemCollection 上表的範例,下表示范 的顯示方式 ListView.CheckedIndexCollection

索引 ListViewItemCollection 中已核取專案的索引
0 1
1 3
2 4

您可以使用這個類別的屬性和方法,搭配集合執行各種工作。 方法 Contains 可讓您判斷 中的 ListView.ListViewItemCollection 索引位置是否為 儲存在 中的 ListView.CheckedIndexCollection 其中一個索引。 一旦您知道專案位於集合中,您就可以使用 IndexOf 方法來判斷索引在 中 ListView.CheckedIndexCollection 的位置。

建構函式

ListView.CheckedIndexCollection(ListView)

初始化 ListView.CheckedIndexCollection 類別的新執行個體。

屬性

Count

取得集合中的項目數目。

IsReadOnly

取得值,表示集合是否為唯讀。

Item[Int32]

取得集合中位於指定索引處的索引值。

方法

Contains(Int32)

判斷指定的索引是否位於集合中。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

傳回用於逐一查看選取索引集合的列舉值。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(Int32)

從清單檢視控制項的 ListView.CheckedIndexCollection 傳回在指定索引之 ListView.ListViewItemCollection 中的索引。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

將核取項目索引的集合複製到陣列中。

ICollection.IsSynchronized

取得值,表示是否同步化存取集合 (執行緒安全)。

ICollection.SyncRoot

取得可用來對控制項集合進行同步 (Synchronize) 存取的物件。

IList.Add(Object)

將項目新增至集合。

IList.Clear()

移除集合的所有項目。

IList.Contains(Object)

檢查與是否已核取與 ListViewItem 對應的索引。

IList.IndexOf(Object)

傳回 ListView.CheckedIndexCollection 中指定之物件的索引。

IList.Insert(Int32, Object)

在指定的索引位置,插入項目至集合之中。

IList.IsFixedSize

取得值,指出 ListView.CheckedIndexCollection 是否有固定的大小。

IList.Item[Int32]

取得或設定 ListView.CheckedIndexCollection 中的物件。

IList.Remove(Object)

從集合移除第一個項目。

IList.RemoveAt(Int32)

從指定索引的集合移除項目。

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱