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 ()

適用於