TreeViewAction Enumeração

Definição

Especifica a ação que levantou um TreeViewEventArgs evento.

public enum class TreeViewAction
public enum TreeViewAction
type TreeViewAction = 
Public Enum TreeViewAction
Herança
TreeViewAction

Campos

Name Valor Description
Unknown 0

A ação que causou o evento é desconhecida.

ByKeyboard 1

O evento foi causado por um toque de tecla.

ByMouse 2

O evento foi causado por uma operação ao rato.

Collapse 3

O evento foi causado pelo colapso TreeNode .

Expand 4

O evento foi causado pela TreeNode expansão.

Exemplos

O exemplo de código seguinte demonstra como usar o TreeView.AfterSelect evento e a TreeViewAction enumeração. Para executar o exemplo, cole o seguinte código numa forma contendo um controlo TreeView chamado TreeView1. Este exemplo assume que o TreeView1 é preenchido com itens e que o TreeView.AfterSelect evento está ligado ao método de gestão de eventos definido na amostra.

private:
   // Handle the After_Select event.
   void TreeView1_AfterSelect( System::Object^ /*sender*/, System::Windows::Forms::TreeViewEventArgs^ e )
   {
      
      // Vary the response depending on which TreeViewAction
      // triggered the event. 
      switch ( (e->Action) )
      {
         case TreeViewAction::ByKeyboard:
            MessageBox::Show( "You like the keyboard!" );
            break;

         case TreeViewAction::ByMouse:
            MessageBox::Show( "You like the mouse!" );
            break;
      }
   }
// Handle the After_Select event.
private void TreeView1_AfterSelect(System.Object sender, 
    System.Windows.Forms.TreeViewEventArgs e)
{

    // Vary the response depending on which TreeViewAction
    // triggered the event. 
    switch((e.Action))
    {
        case TreeViewAction.ByKeyboard:
            MessageBox.Show("You like the keyboard!");
            break;
        case TreeViewAction.ByMouse:
            MessageBox.Show("You like the mouse!");
            break;
    }
}
' Handle the After_Select event.
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.TreeViewEventArgs) _
        Handles TreeView1.AfterSelect

    ' Vary the response depending on which TreeViewAction
    ' triggered the event. 
    Select Case (e.Action)
        Case TreeViewAction.ByKeyboard
            MessageBox.Show("You like the keyboard!")
        Case TreeViewAction.ByMouse
            MessageBox.Show("You like the mouse!")
    End Select
End Sub

Observações

Esta enumeração é usada por membros como o TreeViewEventArgs construtor.

Aplica-se a

Ver também