ToolStripDropDownItem.DropDownOpened Zdarzenie

Definicja

Występuje po otwarciu ToolStripDropDown .

public:
 event EventHandler ^ DropDownOpened;
public event EventHandler DropDownOpened;
public event EventHandler? DropDownOpened;
member this.DropDownOpened : EventHandler 
Public Custom Event DropDownOpened As EventHandler 

Typ zdarzenia

Przykłady

W poniższym przykładzie kodu pokazano, jak obsłużyć DropDownOpened zdarzenie dla wielu ToolStripDropDownItem kontrolek. Ten przykład kodu jest częścią większego przykładu podanego ToolStripDropDownItem dla klasy.

// This method handles the DropDownOpened event from a 
// ToolStripDropDownItem. It displays the value of the 
// item's Text property in the form's StatusStrip control.
void toolStripDropDownItem_DropDownOpened(object sender, EventArgs e)
{
    ToolStripDropDownItem item = sender as ToolStripDropDownItem;

    string msg = String.Format("Item opened: {0}", item.Text);
    this.toolStripStatusLabel1.Text = msg;
}
' This method handles the DropDownOpened event from a 
' ToolStripDropDownItem. It displays the value of the 
' item's Text property in the form's StatusStrip control.
 Private Sub toolStripDropDownItem_DropDownOpened(ByVal sender As Object, ByVal e As EventArgs)

     Dim item As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem)

     Dim msg As String = String.Format("Item opened: {0}", item.Text)
     Me.toolStripStatusLabel1.Text = msg

 End Sub

Uwagi

To zdarzenie występuje, gdy użytkownik kliknie element listy rozwijanej lub po wywołaniu ShowDropDown metody. To zdarzenie służy do dynamicznego wypełniania pliku ToolStripDropDown.

Aby uzyskać więcej informacji na temat obsługi zdarzeń, zobacz Obsługa i podnoszenie zdarzeń.

Dotyczy