TreeNode.NextVisibleNode TreeNode.NextVisibleNode TreeNode.NextVisibleNode TreeNode.NextVisibleNode Property

定義

取得下一個可見的樹狀節點。Gets the next visible tree node.

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

屬性值

TreeNode,表示下一個可見的樹狀節點。A TreeNode that represents the next visible tree node.

範例

下列程式碼範例會在決定TreeNode是否選取了傳入TreeNode的之後,再TreeNode選取適當的。The following code example selects the appropriate TreeNode after determining if the TreeNode passed in is selected and which TreeNode to select. 這個Form範例要求您的具有TreeView具有包含多個TreeNode物件之的TreeNodeCollection控制項。This example requires that you have a Form with a TreeView control that has a TreeNodeCollection that contains several TreeNode objects. 此外,您也需要具有ComboBox具有下列專案的:[上一步]、[PreviousVisible]、[下一步]、[NextVisible]、[第一個] 和 [最後一步]。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

備註

NextVisibleNode可以是子系、兄弟或另一個分支中的樹狀節點。The NextVisibleNode can be a child, sibling, or a tree node from another branch. 如果沒有下一個樹狀節點, NextVisibleNode null屬性會傳回。If there is no next tree node, the NextVisibleNode property returns null.

適用於

另請參閱