Share via


TreeViewCancelEventArgs.Action Özellik

Tanım

Olayı tetikleyen eylemin TreeView türünü alır.

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

Özellik Değeri

Değerlerden TreeViewAction biri.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, bir olay işleyicisi olayın oluşumunu TreeView.BeforeCheck 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ı TreeView1bir tür TreeView örneği içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden TreeView.BeforeCheck emin olun.

private void TreeView1_BeforeCheck(Object sender, TreeViewCancelEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Node", e.Node );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Action", e.Action );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "BeforeCheck Event" );
}
Private Sub TreeView1_BeforeCheck(sender as Object, e as TreeViewCancelEventArgs) _ 
     Handles TreeView1.BeforeCheck

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

End Sub

Şunlara uygulanır

Ayrıca bkz.