System.Windows.Forms
1.0.5000.0
2.0.0.0
System.Windows.Forms.Menu
System.ComponentModel.DefaultEvent("Popup")
The class represents shortcut menus that can be displayed when the user clicks the right mouse button over a control or area of the form. Shortcut menus are typically used to combine different menu items from a of a form that are useful for the user given the context of the application. For example, you can use a shortcut menu assigned to a control to provide menu items for changing the font of the text, finding text within the control, or Clipboard features for copying and pasting text. You can also display new objects in a shortcut menu that are not located within a to provide situation specific commands that are not appropriate for the to display.
Typically, a shortcut menu is displayed when a user clicks the right mouse button over a control or the form itself. Visible controls and have a property that binds the class to the control that displays the shortcut menu. More than one control can use a . You can use the property to determine which control last displayed the shortcut menu in order to perform tasks specific to the control or to modify the shortcut menu displayed for the control.
You might want to know when the shortcut menu is being displayed in order to set check marks, disable items, and perform other menu tasks before the menu is displayed to the user. You can handle the event to determine when the shortcut menu is being displayed.
In order to reuse objects that are displayed in a for use in a , you must create a copy of the menu using the method of the class. You can also merge menu items and their submenu items into a single object using the method of the class.
Represents a shortcut menu. Although replaces and adds functionality to the control of previous versions, is retained for both backward compatibility and future use if you choose.
Constructor
Once you have used this version of the constructor, you can add menu items to the by using the method of the class. You can access the through the property.
Initializes a new instance of the class with no menu items specified.
1.0.5000.0
2.0.0.0
Constructor
You can use this version of the constructor to create a that has its menu items specified at the time it is created. Once you have used this version of the constructor, you can add additional menu items to the by using the method of the class. You can access the through the property.
Initializes a new instance of the class with a specified set of objects.
An array of objects that represent the menu items to add to the shortcut menu.
1.0.5000.0
2.0.0.0
Event
2.0.0.0
System.EventHandler
For more information about handling events, see Consuming Events.
Occurs when the shortcut menu collapses.
Method
2.0.0.0
System.Void
To be added.
Raises the event.
An that contains the event data.
Method
1.0.5000.0
2.0.0.0
System.Void
To be added.
Raises the event
An that contains the event data.
Event
System.EventHandler
You can use this event to initialize the objects before they are displayed. For example, if you use a for three controls and you want to disable certain menu items in the depending on which is displaying the shortcut menu, you can create an event handler for this event. You could use the property to determine which is about to display the and disable the appropriate objects.
For more information about handling events, see Consuming Events.
Occurs before the shortcut menu is displayed.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Boolean
To be added.
To be added.
To be added.
To be added.
To be added.
To be added.
Property
System.ComponentModel.DefaultValue(System.Windows.Forms.RightToLeft.No)
System.ComponentModel.Localizable(true)
System.Windows.Forms.RightToLeft
To be added.
This property enables your menus to support languages that are written from right to left. When this property is set to RightToLeft.Yes, the menu item text is displayed from right to left instead of the default left to right method.
For more information about how enabling right-to-left alignment affects Windows Forms controls, see the property.
Gets or sets a value indicating whether text displayed by the control is displayed from right to left.
1.0.5000.0
2.0.0.0
Method
System.Void
Typically, a is displayed when the user clicks the right mouse button on a control or area of the form that the is bound to. You can use this method to manually display the shortcut menu at a specific location and bind it with a specific control. This method does not return until the menu is dismissed.
Displays the shortcut menu at the specified position.
A that specifies the control with which this shortcut menu is associated.
A that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the parameter.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Void
To be added.
Displays the shortcut menu at the specified position and with the specified alignment.
A that specifies the control with which this shortcut menu is associated.
A that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the parameter.
A that specifies the alignment of the control relative to the parameter.
Property
System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
System.ComponentModel.Browsable(false)
System.Windows.Forms.Control
To be added.
This property enables you to determine which control currently displays the shortcut menu defined in the . If the shortcut menu is not currently displayed, you can use this property to determine which control last displayed the shortcut menu. You can use this property in the event to ensure that the control displays the proper menu items. You can also use this property to pass a reference to the control to a method that performs the tasks associated with a menu command displayed in the shortcut menu. Since the class inherits from , you can also use this property if the is associated with a form.
Gets the control that is displaying the shortcut menu.
1.0.5000.0
2.0.0.0