ToolStripDropDownItem.DropDownOpened Événement

Définition

Se produit lorsque ToolStripDropDown est ouvert.

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

Type d'événement

Exemples

L’exemple de code suivant montre comment gérer l’événement DropDownOpened pour plusieurs ToolStripDropDownItem contrôles. Cet exemple de code fait partie d’un exemple plus grand fourni pour la ToolStripDropDownItem classe .

// 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

Remarques

Cet événement se produit lorsque l’utilisateur clique sur l’élément de liste déroulante ou lorsque vous appelez la ShowDropDown méthode. Vous pouvez utiliser cet événement pour remplir dynamiquement le ToolStripDropDown.

Pour plus d'informations sur la gestion des événements, voir gestion et déclenchement d’événements.

S’applique à