语言

Menu.MenuItemCollection.Item[] 属性

定义

从集合中获取项。

重载

名称 说明
Item[Int32]

MenuItem检索集合中指定索引位置处。

Item[String]

从集合中获取具有指定键的项。

Item[Int32]

Source:
Menu.MenuItemCollection.cs
Source:
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]

Source:
Menu.MenuItemCollection.cs
Source:
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 属性对应于中某个 MenuItem 项的 Menu.MenuItemCollection键。

关键比较不区分大小写。 key如果参数为null空字符串,Item[]则null返回 。

适用于