JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Immediate Solutions: Using the MainMenu Class

There are two main classes involved in standard menu handling—MainMenu, which lets you assign objects of this type to a form's Menu class to install the corresponding menu system, and MenuItem, which is the class that actually supports the items in a menu system (including the menus, like File and Edit). At design time, you only need to drag a MainMenu control from the toolbox to a form—the Windows form designer will add any additional menu items you want to that menu automatically. Here's the class hierarchy of the MainMenu class:

Object
   MarshalByRefObject
      Component
         Menu
            MainMenu

You can find the notable public properties of MainMenu objects in Table 9.1 and the notable public methods of this class in Table 9.2.

Table 9.1: Noteworthy public properties of MainMenu objects.

Property

Means

IsParent

Holds a value that is True if this menu contains any menu items.

MdiListItem

Holds a value that is True if the MenuItem is used to display a list of MDI child windows.

MenuItems

Holds the collection of MenuItem objects for this menu.

Table 9.2: Noteworthy public methods of MainMenu objects.

Method

Means

GetContextMenu

Gets the ContextMenu that contains this menu.

GetForm

Gets the Form that contains this menu.

GetMainMenu

Gets the MainMenu that contains this menu.

MergeMenu

Merges the MenuItem objects of a menu with the current menu.

To create a working menu system, you need menu items. See the next topic for the details.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor