共用方式為


ComboBox.DropDownClosed 事件

定義

發生於下拉式方塊的下拉式清單關閉時。

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

事件類型

範例

下列範例示範如何指派事件處理常式,以及如何處理 DropDownOpenedDropDownClosed 事件。

<ComboBox Name="cb" StaysOpenOnEdit="true" IsEditable="true" DropDownOpened="OnDropDownOpened" 
        DropDownClosed="OnDropDownClosed">
void OnDropDownOpened(object sender, EventArgs e)
{
    if (cb.IsDropDownOpen == true)
    {
        cb.Text = "Combo box opened";
    }
}

void OnDropDownClosed(object sender, EventArgs e)
{
    if (cb.IsDropDownOpen == false)
    {
        cb.Text = "Combo box closed";
    }
}
Private Sub OnDropDownOpened(ByVal Sender As Object, ByVal e As EventArgs)

    If (cb.IsDropDownOpen = True) Then
        cb.Text = "Combo box opened"
    End If

End Sub

Private Sub OnDropDownClosed(ByVal Sender As Object, ByVal e As EventArgs)

    If (cb.IsDropDownOpen = False) Then
        cb.Text = "Combo box closed"
    End If

End Sub

適用於