TreeNode.LastNode Propiedad

Definición

Obtiene el último nodo de árbol secundario.Gets the last child tree node.

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

Valor de propiedad

TreeNode que representa el último nodo de árbol secundario.A TreeNode that represents the last child tree node.

Atributos

Ejemplos

En el ejemplo de código siguiente se selecciona el TreeNode adecuado después de determinar si la TreeNode pasada está seleccionada y qué TreeNode seleccionar.The following code example selects the appropriate TreeNode after determining if the TreeNode passed in is selected and which TreeNode to select. Este ejemplo requiere que tenga un Form con un control TreeView que tenga un TreeNodeCollection que contenga varios objetos TreeNode.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 tenga un ComboBox con los siguientes elementos: "PREVIOUS", "PreviousVisible", "Next", "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

Comentarios

El LastNode es el último TreeNode secundario del TreeNodeCollection almacenado en la propiedad Nodes del nodo de árbol actual.The LastNode is the last child TreeNode in the TreeNodeCollection stored in the Nodes property of the current tree node. Si el TreeNode no tiene ningún nodo de árbol secundario, la propiedad LastNode devuelve null.If the TreeNode has no child tree node, the LastNode property returns null.

Se aplica a

Consulte también: