Menu.MenuItemCollection 類別

定義

表示 MenuItem 物件的集合。Represents a collection of MenuItem objects.

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

備註

此類別代表儲存在 MainMenuContextMenuMenuItem 中 @no__t 0 物件的集合。This class represents the collection of MenuItem objects stored in a MainMenu, ContextMenu, or MenuItem. 若為 MainMenu 和 @no__t 1 類別,此集合代表控制項的整個功能表結構。For the MainMenu and ContextMenu classes, this collection represents the entire menu structure for the control. 若為 MenuItem 類別,此集合代表與 MenuItem 相關聯的子功能表專案清單。For the MenuItem class, this collection represents the list of submenu items associated with the MenuItem.

@No__t-0 和 @no__t 1 方法可讓您從集合中新增和移除個別的功能表項目。The Add and Remove methods enable you to add and remove individual menu items from the collection. 您也可以使用 Clear 方法,從集合中移除所有功能表項目。You can also use the Clear method to remove all the menu items from the collection.

建構函式

Menu.MenuItemCollection(Menu)

初始化 Menu.MenuItemCollection 類別的新執行個體。Initializes a new instance of the Menu.MenuItemCollection class.

屬性

Count

取得值,指出集合中 MenuItem 物件的總數。Gets a value indicating the total number of MenuItem objects in the collection.

IsReadOnly

取得值,表示集合是否為唯讀。Gets a value indicating whether the collection is read-only.

Item[Int32]

擷取集合中指定索引位置的 MenuItemRetrieves the MenuItem at the specified indexed location in the collection.

Item[String]

從集合中取得具有指定索引鍵的項目。Gets an item with the specified key from the collection.

方法

Add(Int32, MenuItem)

將先前建立的 MenuItem 加入功能表項目集合中的指定索引。Adds a previously created MenuItem at the specified index within the menu item collection.

Add(MenuItem)

將先前建立的 MenuItem 加入目前功能表的尾端。Adds a previously created MenuItem to the end of the current menu.

Add(String)

使用指定的標題將新的 MenuItem 加入目前功能表的尾端。Adds a new MenuItem, to the end of the current menu, with a specified caption.

Add(String, EventHandler)

使用指定標題和 MenuItem 事件的指定事件處理常式,將新 Click 加入目前功能表的尾端。Adds a new MenuItem to the end of the current menu with a specified caption and a specified event handler for the Click event.

Add(String, MenuItem[])

使用指定標題、MenuItem 事件處理常式和項目,將新 Click 加入這個功能表的尾端。Adds a new MenuItem to the end of this menu with the specified caption, Click event handler, and items.

AddRange(MenuItem[])

將先前建立的 MenuItem 物件陣列加入集合中。Adds an array of previously created MenuItem objects to the collection.

Clear()

將所有 MenuItem 物件從功能表項目集合移除。Removes all MenuItem objects from the menu item collection.

Contains(MenuItem)

判斷指定的 MenuItem 是否為集合的成員。Determines if the specified MenuItem is a member of the collection.

ContainsKey(String)

判斷集合是否包含具有指定索引鍵的項目。Determines whether the collection contains an item with the specified key.

CopyTo(Array, Int32)

將整個集合複製到現有陣列中的指定位置。Copies the entire collection into an existing array at a specified location within the array.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

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

尋找具有指定索引鍵的項目,並選擇性地搜尋子功能表項目。Finds the items with the specified key, optionally searching the submenu items.

GetEnumerator()

傳回列舉值,其可用來在整個功能表項目集合中重複。Returns an enumerator that can be used to iterate through the menu item collection.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(MenuItem)

擷取集合中指定項目的索引。Retrieves the index of a specific item in the collection.

IndexOfKey(String)

尋找具有指定索引鍵的第一個功能表項目之索引。Finds the index of the first occurrence of a menu item with the specified key.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(MenuItem)

從功能表項目集合中移除指定的 MenuItemRemoves the specified MenuItem from the menu item collection.

RemoveAt(Int32)

MenuItem 自位於指定索引的功能表項目集合中移除。Removes a MenuItem from the menu item collection at a specified index.

RemoveByKey(String)

從集合中移除具有指定索引鍵的功能表項目。Removes the menu item with the specified key from the collection.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICollection.IsSynchronized

如需這個成員的說明,請參閱 IsSynchronizedFor a description of this member, see IsSynchronized.

ICollection.SyncRoot

如需這個成員的說明,請參閱 SyncRootFor a description of this member, see SyncRoot.

IList.Add(Object)

如需這個成員的說明,請參閱 Add(Object)For a description of this member, see Add(Object).

IList.Contains(Object)

如需這個成員的說明,請參閱 Contains(Object)For a description of this member, see Contains(Object).

IList.IndexOf(Object)

如需這個成員的說明,請參閱 IndexOf(Object)For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object)

如需這個成員的說明,請參閱 Insert(Int32, Object)For a description of this member, see Insert(Int32, Object).

IList.IsFixedSize

如需這個成員的說明,請參閱 IsFixedSizeFor a description of this member, see IsFixedSize.

IList.Item[Int32]

如需這個成員的說明,請參閱 Item[Int32]For a description of this member, see Item[Int32].

IList.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)For a description of this member, see Remove(Object).

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於