共用方式為


ToolStripDropDownItem.DropDownItemClicked 事件

定義

發生於按一下 ToolStripDropDown 時。

public:
 event System::Windows::Forms::ToolStripItemClickedEventHandler ^ DropDownItemClicked;
public event System.Windows.Forms.ToolStripItemClickedEventHandler DropDownItemClicked;
public event System.Windows.Forms.ToolStripItemClickedEventHandler? DropDownItemClicked;
member this.DropDownItemClicked : System.Windows.Forms.ToolStripItemClickedEventHandler 
Public Custom Event DropDownItemClicked As ToolStripItemClickedEventHandler 

事件類型

範例

下列程式碼範例示範如何處理多個 ToolStripDropDownItem 控制項的事件 DropDownItemClicked 。 此程式碼範例是針對 類別提供的較大範例的 ToolStripDropDownItem 一部分。

// This method handles the DropDownItemClicked event from a 
// ToolStripDropDownItem. It displays the value of the clicked
// item's Text property in the form's StatusStrip control.
void toolStripDropDownItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
    string msg = String.Format("Item clicked: {0}", e.ClickedItem.Text);
    this.toolStripStatusLabel1.Text = msg;
}
' This method handles the DropDownItemClicked event from a 
' ToolStripDropDownItem. It displays the value of the clicked
' item's Text property in the form's StatusStrip control.
 Private Sub toolStripDropDownItem_DropDownItemClicked( _
 ByVal sender As Object, _
 ByVal e As ToolStripItemClickedEventArgs)

     Dim msg As String = String.Format("Item clicked: {0}", e.ClickedItem.Text)
     Me.toolStripStatusLabel1.Text = msg

 End Sub

備註

如需處理事件的詳細資訊,請參閱 處理和引發事件

適用於