ToolStripDropDown.Closed イベント

定義

ToolStripDropDown が閉じたときに発生します。

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

イベントの種類

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの Closed 発生を報告します。 このレポートは、イベントが発生したタイミングを確認するのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。

コード例を実行するには、 という名前ToolStripDropDown1の型ToolStripDropDownのインスタンスを含むプロジェクトに貼り付けます。 次に、イベント ハンドラーがイベントに関連付けられていることを確認します Closed

private void ToolStripDropDown1_Closed(Object sender, ToolStripDropDownClosedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Closed Event" );
}
Private Sub ToolStripDropDown1_Closed(sender as Object, e as ToolStripDropDownClosedEventArgs) _ 
     Handles ToolStripDropDown1.Closed

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Closed Event")

End Sub

注釈

ToolStripDropDown デリゲートを作成する場合は、イベントを処理するメソッドを指定します。 イベント ハンドラーにイベントを関連付けるには、イベントにデリゲートのインスタンスを追加します。 イベント ハンドラーは、デリゲートを削除しない限り、イベントが発生するたびに呼び出されます。 イベント ハンドラー デリゲートの詳細については、「イベントの 処理と発生」を参照してください。

適用対象