ToolStripDropDownItem.DropDownClosed 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
發生於 ToolStripDropDown 關閉時。
public:
event EventHandler ^ DropDownClosed;
public event EventHandler DropDownClosed;
public event EventHandler? DropDownClosed;
member this.DropDownClosed : EventHandler
Public Custom Event DropDownClosed As EventHandler
事件類型
範例
下列程式碼範例示範如何處理多個 ToolStripDropDownItem 控制項的事件 DropDownClosed 。 此程式碼範例是針對 類別提供的較大範例的 ToolStripDropDownItem 一部分。
// This method handles the DropDownClosed event from a
// ToolStripDropDownItem. It displays the value of the
// item's Text property in the form's StatusStrip control.
void toolStripDropDownItem_DropDownClosed(object sender, EventArgs e)
{
ToolStripDropDownItem item = sender as ToolStripDropDownItem;
string msg = String.Format("Item closed: {0}", item.Text);
this.toolStripStatusLabel1.Text = msg;
}
' This method handles the DropDownClosed event from a
' ToolStripDropDownItem. It displays the value of the
' item's Text property in the form's StatusStrip control.
Private Sub toolStripDropDownItem_DropDownClosed(ByVal sender As Object, ByVal e As EventArgs)
Dim item As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem)
Dim msg As String = String.Format("Item closed: {0}", item.Text)
Me.toolStripStatusLabel1.Text = msg
End Sub
備註
如需處理事件的詳細資訊,請參閱 處理和引發事件。