TreeNode.FullPath 속성

정의

루트 트리 노드에서 현재 트리 노드까지의 경로를 가져옵니다.

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

속성 값

String

루트 트리 노드에서 현재 트리 노드까지의 경로입니다.

특성

예외

TreeView에 노드가 없는 경우

예제

다음 코드 예제에서는 a TreeViewPathSeparator 속성을 설정 하 고의 포함 TreeNodeCollection 된 자식 트리 노드의 SelectedNode수를 표시 합니다. 트리 뷰 컨트롤의 총 트리 노드에 대한 자식 트리 노드의 백분율도 표시됩니다. 이 예제에서는 Form Button여러 TreeNode 개체가 있는 컨트롤(TreeView바람직하게는 3개 이상의 수준 포함)을 포함하는 컨트롤 TreeNodeCollection 이 있어야 합니다.

void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{

   // Set the tree view's PathSeparator property.
   myTreeView->PathSeparator = ".";

   // Get the count of the child tree nodes contained in the SelectedNode.
   int myNodeCount = myTreeView->SelectedNode->GetNodeCount( true );
   Decimal myChildPercentage = ((Decimal)myNodeCount / (Decimal)myTreeView->GetNodeCount( true )) * 100;

   // Display the tree node path and the number of child nodes it and the tree view have.
   MessageBox::Show( String::Concat( "The '", myTreeView->SelectedNode->FullPath, "' node has ", myNodeCount, " child nodes.\nThat is ", String::Format( "{0:###.##}", myChildPercentage ), "% of the total tree nodes in the tree view control." ) );
}
private void myButton_Click(object sender, System.EventArgs e)
{
   // Set the tree view's PathSeparator property.
   myTreeView.PathSeparator = ".";

   // Get the count of the child tree nodes contained in the SelectedNode.
   int myNodeCount = myTreeView.SelectedNode.GetNodeCount(true);
   decimal myChildPercentage = ((decimal)myNodeCount/
     (decimal)myTreeView.GetNodeCount(true)) * 100;

   // Display the tree node path and the number of child nodes it and the tree view have.
   MessageBox.Show("The '" + myTreeView.SelectedNode.FullPath + "' node has "
     + myNodeCount.ToString() + " child nodes.\nThat is "
     + string.Format("{0:###.##}", myChildPercentage)
     + "% of the total tree nodes in the tree view control.");
}
Private Sub myButton_Click(ByVal sender As Object, _
  ByVal e As System.EventArgs) Handles myButton.Click
   ' Set the tree view's PathSeparator property.
   myTreeView.PathSeparator = "."

   ' Get the count of the child tree nodes contained in the SelectedNode.
   Dim myNodeCount As Integer = myTreeView.SelectedNode.GetNodeCount(True)
   Dim myChildPercentage As Decimal = CDec(myNodeCount) / _
      CDec(myTreeView.GetNodeCount(True)) * 100

   ' Display the tree node path and the number of child nodes it and the tree view have.
   MessageBox.Show(("The '" + myTreeView.SelectedNode.FullPath + "' node has " _
      + myNodeCount.ToString() + " child nodes." + Microsoft.VisualBasic.ControlChars.Lf _
      + "That is " + String.Format("{0:###.##}", myChildPercentage) _
      + "% of the total tree nodes in the tree view control."))
End Sub

설명

경로는 루트 트리 노드에서 시작하여 이 트리 노드에 도달하기 위해 탐색해야 하는 모든 트리 노드의 레이블로 구성됩니다. 노드 레이블은 이 노드를 포함하는 컨트롤의 TreeView 속성에 PathSeparator 지정된 구분 기호 문자로 구분됩니다. 예를 들어 "Location"이라는 트리 뷰 컨트롤의 구분 기호 문자가 백슬래시 문자()\FullPath로 설정된 경우 속성 값은 "Country\Region\State"입니다.

적용 대상

추가 정보