ToolStripDropDown.Close Method

Definition

Closes the ToolStripDropDown control.

Overloads

Close(ToolStripDropDownCloseReason)

Closes the ToolStripDropDown control for the specified reason.

Close()

Closes the ToolStripDropDown control.

Close(ToolStripDropDownCloseReason)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Closes the ToolStripDropDown control for the specified reason.

C#
public void Close(System.Windows.Forms.ToolStripDropDownCloseReason reason);

Parameters

Examples

The following code example demonstrates how to specify a close reason when explicitly closing a ToolStripDropDown control with the Close method.

C#
// This method explicitly closes the ToolStripDropDown control
// and specifies the reason for closing as CloseCalled.
private void closeButton_Click(object sender, EventArgs e)
{
    this.contextMenuStrip1.Close(ToolStripDropDownCloseReason.CloseCalled);
}

Remarks

Use the Close method to close a ToolStripDropDown control under specific conditions, such as when an application is started or an item is selected by clicking the control, if the focus changes, or if specified keyboard action occurs.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

Close()

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Closes the ToolStripDropDown control.

C#
public void Close();

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9