![]() ![]() | ||
The actual menus and menu items in a menu system are supported by the MenuItem class—these are the objects that you handle Click events for in a menu system. Here's the hierarchy of this class:
Object MarshalByRefObject Component Menu MenuItem
You can see the notable public properties of objects of the MenuItem class in Table 9.3, the notable methods in Table 9.4, and the notable events in Table 9.5.
Property |
Means |
---|---|
Break |
Gets/sets whether the item is displayed on a new line (for menu items added to a MainMenu object) or in a new column (for items or submenu items displayed in a ContextMenu). |
Checked |
Gets/sets if a checkmark should appear next to a menu item. |
DefaultItem |
Gets/sets if the menu item is the default menu item. |
Enabled |
Gets/sets if the menu item is enabled. |
Index |
Gets/sets the position of the menu item in its parent menu. |
IsParent |
Gets if the menu item contains child menu items. |
MdiList |
Gets/sets if the menu item will be automatically filled with a list of Multiple Document Interface (MDI) child windows that are displayed in the associated form. |
MdiListItem |
Gets the menu item used to display a list of Multiple Document Interface (MDI) child forms. |
MenuItems |
Gets the collection of menu item objects for the menu. |
MergeOrder |
Gets/sets the relative position of the menu item when it is merged with another menu. |
MergeType |
Gets/sets the behavior of this menu item when its menu is merged with another menu. |
Mnemonic |
Gets the mnemonic character for this menu item. |
OwnerDraw |
Gets/sets whether you will draw this item in code or not. |
Parent |
Returns the menu that contains this menu item. |
RadioCheck |
Gets/sets whether the menu item, if checked, displays a radio-button (instead of a checkmark). |
Shortcut |
Gets/sets the shortcut key for the menu item. |
ShowShortcut |
Gets/sets whether a shortcut key for the menu item is displayed next to the menu item. |
Text |
Gets/sets the caption of the menu item. |
Visible |
Gets/sets whether the menu item is visible. |
Method |
Means |
---|---|
CloneMenu |
Creates a copy of a menu item. |
GetContextMenu |
Gets the ContextMenu that contains this menu. |
GetMainMenu |
Gets the MainMenu that contains this menu. |
MergeMenu |
Merges this menu item with another menu item. |
PerformClick |
Creates a Click event for the menu item. |
PerformSelect |
Creates a Select event for this menu item. |
Event |
Means |
---|---|
Click |
Occurs when the menu item is clicked or selected using a shortcut key or access key for the menu item. |
DrawItem |
Occurs when the OwnerDraw property of a menu item is set to True and the menu item should be drawn. |
MeasureItem |
Occurs when Visual Basic wants to know the size of a menu item before drawing it (usually happens before the DrawItem event). |
Popup |
Occurs before a menu item's list of menu items is displayed. |
Select |
Occurs when the user moves the cursor over a menu item. |
![]() ![]() | ||