Gets the last control that caused this ContextMenuStrip to be displayed.
member SourceControl : Control with get
The control that caused this ContextMenuStrip to be displayed.
Common uses of the SourceControl property include the following:
Adding, removing, enabling, or disabling a menu item during the Opening event.
Deciding on modifications of a chosen command based on the control that last displayed the ContextMenuStrip.
The following code example demonstrates dynamic SourceControl determination with reuse, and handling of the Opening event. This example is part of a larger example provided for the ContextMenuStrip class.
for all windows to set this property value. Associated enumeration: UIPermissionWindow.AllWindows
ContextMenuStrip ClassSystem.Windows.Forms Namespace