JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the ContextMenu Class

Context menus are those handy menus that pop up over controls, usually when you right-click them. They're called context menus because they appear over specific controls—that is, in the context of that control, and so can be tailored to that control. They're supported by the ContextMenu class, which has this class hierarchy:

Object
   MarshalByRefObject
      Component
         Menu
            ContextMenu

You can find the notable public properties of ContextMenu objects in Table 9.6, their notable methods in Table 9.7, and their notable events in Table 9.8.

Table 9.6: Noteworthy public properties of ContextMenu objects.

Property

Means

IsParent

True if this menu contains any menu items. This property is read-only.

MdiListItem

Holds the MenuItem that is used to display a list of MDI child forms.

MenuItems

Holds the collection of MenuItem objects associated with the menu.

SourceControl

Holds the control that is displaying the shortcut menu.

Table 9.7: Noteworthy public methods of ContextMenu objects.

Method

Means

GetContextMenu

Gets the context menu that contains this menu.

GetMainMenu

Gets the MainMenu object that contains this menu.

MergeMenu

Merges the MenuItem objects of one menu with the another menu.

Show

Displays the shortcut menu.

Table 9.8: Noteworthy public events of ContextMenu objects.

Event

Means

Popup

Occurs before the context menu is displayed.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor