다음을 통해 공유


TreeNode.TreeView 속성

정의

트리 노드가 할당된 부모 트리 뷰를 가져옵니다.

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

속성 값

TreeView

트리 노드가 할당된 부모 트리 뷰를 나타내는 TreeView이고, 노드가 트리 뷰에 할당되지 않았으면 null입니다.

특성

예제

다음 코드 예제에서는 전달된 작업이 선택되어 있는지 TreeNodeTreeNode 선택할 것인지를 결정한 후 적절한 TreeNode 옵션을 선택합니다. 이 예제에서는 여러 TreeNode 개체가 Form TreeView 포함된 컨트롤이 TreeNodeCollection 있어야 합니다. 또한 "Previous", "PreviousVisible", "Next", "NextVisible", "First" 및 "Last" 항목이 있어야 합니다 ComboBox .

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

적용 대상

추가 정보