語言

Menu.MenuItemCollection.Item[] 屬性

定義

從收藏中取得一件物品。

多載

名稱 Description
Item[Int32]

在集合中指定的索引位置檢索 。MenuItem

Item[String]

從集合中取得一個帶有指定金鑰的項目。

Item[Int32]

來源:
Menu.MenuItemCollection.cs
來源:
Menu.MenuItemCollection.cs

在集合中指定的索引位置檢索 。MenuItem

public:
 virtual property System::Windows::Forms::MenuItem ^ default[int] { System::Windows::Forms::MenuItem ^ get(int index); };
public virtual System.Windows.Forms.MenuItem this[int index] { get; }
member this.Item(int) : System.Windows.Forms.MenuItem
Default Public Overridable ReadOnly Property Item(index As Integer) As MenuItem

參數

index
Int32

收藏中 的 MenuItem 索引位置。

屬性值

他們 MenuItem 在指定的地點。

例外狀況

參數 value 為 null。

或

參數 index 小於零。

或

參數 index 大於集合中選單項目的數量,而選單項目的集合不 null大。

備註

若要將物件指派 MenuItem 到特定位置,或從 Menu.MenuItemCollection中擷取物件,您可以使用特定的索引值來參考集合物件。 的 Menu.MenuItemCollection 索引值為零為基礎的索引。

另請參閱

適用於

Item[String]

來源:
Menu.MenuItemCollection.cs
來源:
Menu.MenuItemCollection.cs

從集合中取得一個帶有指定金鑰的項目。

public:
 virtual property System::Windows::Forms::MenuItem ^ default[System::String ^] { System::Windows::Forms::MenuItem ^ get(System::String ^ key); };
public virtual System.Windows.Forms.MenuItem this[string key] { get; }
member this.Item(string) : System.Windows.Forms.MenuItem
Default Public Overridable ReadOnly Property Item(key As String) As MenuItem

參數

key
String

要從收藏中取回的物品名稱。

屬性值

該MenuItem

備註

該Name性質對應於 中 a 的MenuItemMenu.MenuItemCollection鍵。

關鍵比較並不區分大小寫。 若 key 參數為 null 或 為空字串,則 Item[] 回傳 null。

適用於