ToolStripDropDown.Close 方法

定义

关闭 ToolStripDropDown 控件。

重载

Close(ToolStripDropDownCloseReason)

因为特定原因而关闭 ToolStripDropDown 控件。

Close()

关闭 ToolStripDropDown 控件。

Close(ToolStripDropDownCloseReason)

因为特定原因而关闭 ToolStripDropDown 控件。

public:
 void Close(System::Windows::Forms::ToolStripDropDownCloseReason reason);
public void Close (System.Windows.Forms.ToolStripDropDownCloseReason reason);
member this.Close : System.Windows.Forms.ToolStripDropDownCloseReason -> unit
Public Sub Close (reason As ToolStripDropDownCloseReason)

参数

示例

下面的代码示例演示如何使用该方法显式关闭 ToolStripDropDown 控件 Close 时指定关闭原因。

// 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);
}
' This method explicitly closes the ToolStripDropDown control
' and specifies the reason for closing as CloseCalled.
Private Sub closeButton_Click(sender As Object, e As EventArgs) Handles closeButton.Click
   Me.contextMenuStrip1.Close(ToolStripDropDownCloseReason.CloseCalled)
 End Sub

注解

Close使用此方法可在特定条件下关闭ToolStripDropDown控件,例如当应用程序启动时或通过单击控件选择项目、焦点更改或指定键盘操作发生时。

另请参阅

适用于

Close()

关闭 ToolStripDropDown 控件。

public:
 void Close();
public void Close ();
member this.Close : unit -> unit
Public Sub Close ()

适用于