TreeNode.LastNode Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the last child tree node.
public:
property System::Windows::Forms::TreeNode ^ LastNode { System::Windows::Forms::TreeNode ^ get(); };
public System.Windows.Forms.TreeNode LastNode { get; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.TreeNode LastNode { get; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.TreeNode? LastNode { get; }
member this.LastNode : System.Windows.Forms.TreeNode
[<System.ComponentModel.Browsable(false)>]
member this.LastNode : System.Windows.Forms.TreeNode
Public ReadOnly Property LastNode As TreeNode
A TreeNode that represents the last child tree node.
- Attributes
The following code example selects the appropriate TreeNode after determining if the TreeNode passed in is selected and which TreeNode to select. This example requires that you have a Form with a TreeView control that has a TreeNodeCollection that contains several TreeNode objects. 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
The LastNode is the last child TreeNode in the TreeNodeCollection stored in the Nodes property of the current tree node. If the TreeNode has no child tree node, the LastNode property returns null
.
Продукт | Версії |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Відгук про .NET
.NET – це проект із відкритим кодом. Виберіть посилання, щоб надати відгук: