TreeView.AfterSelect TreeView.AfterSelect TreeView.AfterSelect TreeView.AfterSelect Event

Definición

Se produce después de seleccionarse el nodo de árbol.Occurs after the tree node is selected.

public:
 event System::Windows::Forms::TreeViewEventHandler ^ AfterSelect;
public event System.Windows.Forms.TreeViewEventHandler AfterSelect;
member this.AfterSelect : System.Windows.Forms.TreeViewEventHandler 
Public Custom Event AfterSelect As TreeViewEventHandler 

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar el TreeViewAction enumeración.The following code example demonstrates how to use the TreeViewAction enumeration. Para ejecutar este ejemplo, pegue el código siguiente en un formulario que contiene un TreeView control denominado TreeView1.To run this example, paste the following code in a form that contains a TreeView control named TreeView1. Este ejemplo requiere que TreeView1 se rellena con elementos y el AfterSelect evento está conectado al controlador de eventos definido en el ejemplo.This example requires that TreeView1 is populated with items and the AfterSelect event is connected to the event handler defined in the sample.

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

Comentarios

Este evento no se produce cuando el nodo está seleccionado.This event does not occur when the node is unselected. Para detectar si se borró la selección, puede probar la TreeNode.IsSelected propiedad.To detect whether the selection was cleared, you can test the TreeNode.IsSelected property.

Para obtener más información sobre el manejo de eventos, consulte controlar y provocar eventos.For more information about handling events, see Handling and Raising Events.

Se aplica a

Consulte también: