System.Windows.Forms.Menu.GetContextMenu Method

Gets the System.Windows.Forms.ContextMenu that contains this menu.

Syntax

public ContextMenu GetContextMenu ()

Returns

The System.Windows.Forms.ContextMenu that contains this menu. The default is null.

Remarks

This method allows you to obtain a reference to the System.Windows.Forms.ContextMenu that this menu is contained in. This property returns null if the menu is not contained in a System.Windows.Forms.ContextMenu. This can occur if the menu is contained in a System.Windows.Forms.MenuItem or System.Windows.Forms.MainMenu, or if the menu is not contained in any menu. You can use this property to determine whether a menu is currently being used, and also to determine where.

Requirements

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