Menu.MenuItemCollection 类

表示 MenuItem 对象的集合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Class MenuItemCollection
    Implements IList, ICollection, IEnumerable
用法
Dim instance As MenuItemCollection
public class MenuItemCollection : IList, ICollection, IEnumerable
public ref class MenuItemCollection : IList, ICollection, IEnumerable
public class MenuItemCollection implements IList, ICollection, 
    IEnumerable
public class MenuItemCollection implements IList, ICollection, 
    IEnumerable

备注

该类表示存储在 MainMenuContextMenuMenuItem 中的 MenuItem 对象的集合。对于 MainMenuContextMenu 类,该集合表示控件的整个菜单结构。对于 MenuItem 类,该集合表示与 MenuItem 关联的子菜单项的列表。

AddRemove 方法使您能够向该集合添加和从中移除单个菜单项。还可使用 Clear 方法从集合中移除所有菜单项。

继承层次结构

System.Object
  System.Windows.Forms.Menu.MenuItemCollection

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Menu.MenuItemCollection 成员
System.Windows.Forms 命名空间