System.Windows.Forms.ContextMenu.Popup Event

Occurs before the shortcut menu is displayed.

Syntax

public event EventHandler Popup

Remarks

You can use this event to initialize the System.Windows.Forms.MenuItem objects before they are displayed. For example, if you use a System.Windows.Forms.ContextMenu for three System.Windows.Forms.TextBox controls and you want to disable certain menu items in the System.Windows.Forms.ContextMenu depending on which System.Windows.Forms.TextBox is displaying the shortcut menu, you can create an event handler for this event. You could use the ContextMenu.SourceControl property to determine which System.Windows.Forms.TextBox is about to display the System.Windows.Forms.ContextMenu and disable the appropriate System.Windows.Forms.MenuItem objects.

For more information about handling events, see Consuming Events.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0