TreeViewAction (Enumeración) (System.Windows.Forms)

Cambiar vista:
Sin script
Biblioteca de clases de .NET Framework
TreeViewAction (Enumeración)

Actualización: noviembre 2007

Especifica la acción que ha provocado un evento TreeViewEventArgs.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Sintaxis

Visual Basic (Declaración)
Public Enumeration TreeViewAction
Visual Basic (Uso)
Dim instance As TreeViewAction
C#
public enum TreeViewAction
Visual C++
public enum class TreeViewAction
J#
public enum TreeViewAction
JScript
public enum TreeViewAction
Miembros

Nombre de miembro Descripción
ae8a59bf.CFW(es-es,VS.90).gif Unknown Se desconoce la acción que ha causado el evento.
ae8a59bf.CFW(es-es,VS.90).gif ByKeyboard Una pulsación de tecla ha ocasionado el evento.
ae8a59bf.CFW(es-es,VS.90).gif ByMouse Una operación del mouse (ratón) ha ocasionado el evento.
ae8a59bf.CFW(es-es,VS.90).gif Collapse TreeNode que se contrae ha ocasionado el evento.
ae8a59bf.CFW(es-es,VS.90).gif Expand TreeNode que se expande ha ocasionado el evento.
Comentarios

Los miembros como el constructor TreeViewEventArgs utilizan esta enumeración.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar el evento TreeView.AfterSelect y la enumeración TreeViewAction. Para ejecutar el ejemplo, pegue el siguiente código en un formulario que contenga un control TreeView denominado TreeView1. Este ejemplo supone que TreeView1 se rellena con elementos y el evento TreeView.AfterSelect se conecta al método de control de eventos definido en el ejemplo.

Visual Basic
' 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


C#
	// 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;
		}
	}


Visual C++
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;
      }
   }


J#
// Handle the After_Select event.
private void treeView1_AfterSelect(Object sender,
    System.Windows.Forms.TreeViewEventArgs e)
{
    // Vary the response depending on which TreeViewAction
    // triggered the event. 
    switch (e.get_Action()) {
        case TreeViewAction.ByKeyboard:
            MessageBox.Show("You like the keyboard!");
            break;
        case TreeViewAction.ByMouse:
            MessageBox.Show("You like the mouse!");
            break;
    }
} //treeView1_AfterSelect


Plataformas

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile para Smartphone, Windows Mobile para Pocket PC

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión

.NET Framework

Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Compatible con: 3.5, 2.0, 1.0
Vea también

Referencia