Menu.MenuItemCollection 類別

定義

表示 MenuItem 物件的集合。

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

備註

這個類別代表儲存在 、 ContextMenuMenuItem 中的 MainMenu 物件集合 MenuItemMainMenu對於 和 ContextMenu 類別,這個集合代表控制項的整個功能表結構。 針對 類別 MenuItem ,這個集合代表與 相關聯的 MenuItem 子功能表專案清單。

AddRemove 方法可讓您從集合中新增和移除個別功能表項目。 您也可以使用 Clear 方法,從集合中移除所有功能表項目。

建構函式

Menu.MenuItemCollection(Menu)

初始化 Menu.MenuItemCollection 類別的新執行個體。

屬性

Count

取得值,指出集合中 MenuItem 物件的總數。

IsReadOnly

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

Item[Int32]

擷取集合中指定索引位置的 MenuItem

Item[String]

從集合中取得具有指定索引鍵的項目。

方法

Add(Int32, MenuItem)

將先前建立的 MenuItem 加入功能表項目集合中的指定索引。

Add(MenuItem)

將先前建立的 MenuItem 加入目前功能表的尾端。

Add(String)

使用指定的標題將新的 MenuItem 加入目前功能表的尾端。

Add(String, EventHandler)

使用指定標題和 MenuItem 事件的指定事件處理常式,將新 Click 加入目前功能表的尾端。

Add(String, MenuItem[])

使用指定標題、MenuItem 事件處理常式和項目,將新 Click 加入這個功能表的尾端。

AddRange(MenuItem[])

將先前建立的 MenuItem 物件陣列加入集合中。

Clear()

將所有 MenuItem 物件從功能表項目集合移除。

Contains(MenuItem)

判斷指定的 MenuItem 是否為集合的成員。

ContainsKey(String)

判斷集合是否包含具有指定索引鍵的項目。

CopyTo(Array, Int32)

將整個集合複製到現有陣列中的指定位置。

Equals(Object)

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

(繼承來源 Object)
Find(String, Boolean)

尋找具有指定索引鍵的項目,並選擇性地搜尋子功能表項目。

GetEnumerator()

傳回列舉值,其可用來在整個功能表項目集合中重複。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(MenuItem)

擷取集合中指定項目的索引。

IndexOfKey(String)

尋找具有指定索引鍵的第一個功能表項目之索引。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(MenuItem)

從功能表項目集合中移除指定的 MenuItem

RemoveAt(Int32)

MenuItem 自位於指定索引的功能表項目集合中移除。

RemoveByKey(String)

從集合中移除具有指定索引鍵的功能表項目。

ToString()

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

(繼承來源 Object)

明確介面實作

ICollection.IsSynchronized

如需這個成員的說明,請參閱 IsSynchronized

ICollection.SyncRoot

如需這個成員的說明,請參閱 SyncRoot

IList.Add(Object)

如需這個成員的說明,請參閱 Add(Object)

IList.Contains(Object)

如需這個成員的說明,請參閱 Contains(Object)

IList.IndexOf(Object)

如需這個成員的說明,請參閱 IndexOf(Object)

IList.Insert(Int32, Object)

如需這個成員的說明,請參閱 Insert(Int32, Object)

IList.IsFixedSize

如需這個成員的說明,請參閱 IsFixedSize

IList.Item[Int32]

如需這個成員的說明,請參閱 Item[Int32]

IList.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)

擴充方法

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於