Share via


ToolStripDropDownClosedEventArgs.CloseReason Özellik

Tanım

Kapatma nedenini ToolStripDropDown alır.

public:
 property System::Windows::Forms::ToolStripDropDownCloseReason CloseReason { System::Windows::Forms::ToolStripDropDownCloseReason get(); };
public System.Windows.Forms.ToolStripDropDownCloseReason CloseReason { get; }
member this.CloseReason : System.Windows.Forms.ToolStripDropDownCloseReason
Public ReadOnly Property CloseReason As ToolStripDropDownCloseReason

Özellik Değeri

Değerlerden ToolStripDropDownCloseReason biri.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, bir olay işleyicisi olayın oluşumunu ToolStripDropDown.Closed raporlar. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile Console.WriteLine değiştirmeyi MessageBox.Show veya çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı ToolStripDropDown1bir tür ToolStripDropDown örneği içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden ToolStripDropDown.Closed emin olun.

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

Şunlara uygulanır