Class Menu
This is the base class for all menu components (MainMenu, MenuItem, and ContextMenu).
[ListBindable(false)]
public abstract class Menu : Component, IComponent, IDisposable
- Inheritance
-
Menu
- Implements
- Derived
- Inherited Members
Constructors
Menu(MenuItem[])
This is an abstract class. Instances cannot be created, so the constructor is only called from derived classes.
protected Menu(MenuItem[] items)
Parameters
items
MenuItem[]
Fields
FindHandle
Used by findMenuItem
public const int FindHandle = 0
Field Value
FindShortcut
Used by findMenuItem
public const int FindShortcut = 1
Field Value
Properties
Handle
The HMENU handle corresponding to this menu.
[Browsable(false)]
public nint Handle { get; }
Property Value
IsParent
Specifies whether this menu contains any items.
[Browsable(false)]
public virtual bool IsParent { get; }
Property Value
MdiListItem
The MenuItem that contains the list of MDI child windows.
[Browsable(false)]
public MenuItem MdiListItem { get; }
Property Value
MenuItems
[Browsable(false)]
public Menu.MenuItemCollection MenuItems { get; }
Property Value
Name
Name of this control. The designer will set this to the same as the programatic Id "(name)" of the control - however this property has no bearing on the runtime aspects of this control.
[Browsable(false)]
public string Name { get; set; }
Property Value
Tag
[Bindable(true)]
[TypeConverter(typeof(StringConverter))]
public object Tag { get; set; }
Property Value
Methods
CloneMenu(Menu)
Sets this menu to be an identical copy of another menu.
protected void CloneMenu(Menu menuSrc)
Parameters
menuSrc
Menu
CreateMenuHandle()
protected virtual nint CreateMenuHandle()
Returns
Dispose(bool)
Disposes of the component. Call dispose when the component is no longer needed. This method removes the component from its container (if the component has a site) and triggers the dispose event.
protected override void Dispose(bool disposing)
Parameters
disposing
bool
FindMenuItem(int, nint)
public MenuItem FindMenuItem(int type, nint value)
Parameters
Returns
FindMergePosition(int)
protected int FindMergePosition(int mergeOrder)
Parameters
mergeOrder
int
Returns
GetContextMenu()
Returns the ContextMenu that contains this menu. The ContextMenu is at the top of this menu's parent chain. Returns null if this menu is not contained in a ContextMenu. This can occur if it's contained in a MainMenu or if it isn't currently contained in any menu at all.
public ContextMenu GetContextMenu()
Returns
GetMainMenu()
Returns the MainMenu item that contains this menu. The MainMenu is at the top of this menu's parent chain. Returns null if this menu is not contained in a MainMenu. This can occur if it's contained in a ContextMenu or if it isn't currently contained in any menu at all.
public MainMenu GetMainMenu()
Returns
MergeMenu(Menu)
Merges another menu's items with this one's. Menu items are merged according to their mergeType and mergeOrder properties. This function is typically used to merge an MDI container's menu with that of its active MDI child.
public virtual void MergeMenu(Menu menuSrc)
Parameters
menuSrc
Menu
ProcessCmdKey(ref Message, Keys)
protected virtual bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
Returns
ToString()
Returns a string representation for this control.
public override string ToString()