TreeNode.TreeView TreeNode.TreeView TreeNode.TreeView TreeNode.TreeView Property

Definición

Obtiene al elemento primario de vista de árbol que el nodo de árbol se asigna a.Gets the parent tree view that the tree node is assigned to.

public:
 property System::Windows::Forms::TreeView ^ TreeView { System::Windows::Forms::TreeView ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.TreeView TreeView { get; }
member this.TreeView : System.Windows.Forms.TreeView
Public ReadOnly Property TreeView As TreeView

Valor de propiedad

Un TreeView que representa la vista de árbol primaria que está asignado el nodo de árbol, o null si el nodo no se ha asignado a una vista de árbol.A TreeView that represents the parent tree view that the tree node is assigned to, or null if the node has not been assigned to a tree view.

Ejemplos

En el ejemplo de código siguiente se selecciona el apropiado TreeNode después de determinar si el TreeNode pasa en está seleccionada y que TreeNode para seleccionar.The following code example selects the appropriate TreeNode after determining if the TreeNode passed in is selected and which TreeNode to select. En este ejemplo requiere que haya un Form con un TreeView control que tiene un TreeNodeCollection que contenga varias TreeNode objetos.This example requires that you have a Form with a TreeView control that has a TreeNodeCollection that contains several TreeNode objects. También requiere que haya un ComboBox con los siguientes elementos: "Anterior", "PreviousVisible", "Siguiente", "NextVisible", "First" y "Last".It also requires that you have a ComboBox with the following items: "Previous", "PreviousVisible", "Next", "NextVisible", "First", and "Last".

void SelectNode( TreeNode^ node )
{
   if ( node->IsSelected )
   {
      
      // Determine which TreeNode to select.
      String^ str = myComboBox->Text;
      if ( str->Equals( "Previous" ) )
               node->TreeView->SelectedNode = node->PrevNode;
      else
      if ( str->Equals( "PreviousVisible" ) )
               node->TreeView->SelectedNode = node->PrevVisibleNode;
      else
      if ( str->Equals( "Next" ) )
               node->TreeView->SelectedNode = node->NextNode;
      else
      if ( str->Equals( "NextVisible" ) )
               node->TreeView->SelectedNode = node->NextVisibleNode;
      else
      if ( str->Equals( "First" ) )
               node->TreeView->SelectedNode = node->FirstNode;
      else
      if ( str->Equals( "Last" ) )
               node->TreeView->SelectedNode = node->LastNode;
   }

   node->TreeView->Focus();
}
private void SelectNode(TreeNode node)
{
	if(node.IsSelected)
	{
		// Determine which TreeNode to select.
		switch(myComboBox.Text)
		{
			case "Previous":
				node.TreeView.SelectedNode = node.PrevNode;
				break;
			case "PreviousVisible":
				node.TreeView.SelectedNode = node.PrevVisibleNode;
				break;
			case "Next":
				node.TreeView.SelectedNode = node.NextNode;
				break;
			case "NextVisible":
				node.TreeView.SelectedNode = node.NextVisibleNode;
				break;
			case "First":
				node.TreeView.SelectedNode = node.FirstNode;
				break;
			case "Last":
				node.TreeView.SelectedNode = node.LastNode;
				break;
		}
	}
	node.TreeView.Focus();
}
Private Sub SelectNode(node As TreeNode)
   If node.IsSelected Then
      ' Determine which TreeNode to select.
      Select Case myComboBox.Text
         Case "Previous"
            node.TreeView.SelectedNode = node.PrevNode
         Case "PreviousVisible"
            node.TreeView.SelectedNode = node.PrevVisibleNode
         Case "Next"
            node.TreeView.SelectedNode = node.NextNode
         Case "NextVisible"
            node.TreeView.SelectedNode = node.NextVisibleNode
         Case "First"
            node.TreeView.SelectedNode = node.FirstNode
         Case "Last"
            node.TreeView.SelectedNode = node.LastNode
      End Select
   End If
   node.TreeView.Focus()
End Sub

Se aplica a

Consulte también: