Assembly : System.Windows.Forms (dans system.windows.forms.dll)
SyntaxePublic Property PathSeparator As String
Dim instance As TreeView Dim value As String value = instance.PathSeparator instance.PathSeparator = value
public string PathSeparator { get; set; }
public: property String^ PathSeparator { String^ get (); void set (String^ value); }
/** @property */ public String get_PathSeparator () /** @property */ public void set_PathSeparator (String value)
public function get PathSeparator () : String public function set PathSeparator (value : String)
Valeur de la propriété
Chaîne de délimiteur utilisée par la propriété TreeNode.FullPath du n?ud d'arbre. La valeur par défaut est une barre oblique inverse (\).
NotesLe chemin d'accès de n?ud d'arbre est constitué d'étiquettes de n?ud d'arbre séparées par les chaînes de délimiteur PathSeparator. Les étiquettes vont du n?ud d'arbre racine au n?ud d'arbre souhaité.
ExempleL'exemple de code suivant définit la propriété PathSeparator d'un TreeView et affiche le nombre de n?uds d'arbre enfants contenus dans le TreeNodeCollection de SelectedNode. Le pourcentage des n?uds d'arbre enfants par rapport au nombre total de n?uds d'arbre du contrôle TreeView est également affiché. Cet exemple requiert que vous ayez un Form avec un Button, ainsi qu'un contrôle TreeView avec un TreeNodeCollection comportant plusieurs objets TreeNode (si possible avec trois niveaux ou plus).
Private Sub myButton_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles myButton.Click ' Set the tre 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
private void myButton_Click(object sender, System.EventArgs e) { // Set the tre 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."); }
void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // Set the tre 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 tre view's PathSeparator property. myTreeView.set_PathSeparator("."); // Get the count of the child tree nodes contained in the SelectedNode. int myNodeCount = myTreeView.get_SelectedNode().GetNodeCount(true); System.Decimal myChildPercentage = Decimal.Multiply(Decimal.Divide(new Decimal(myNodeCount), new Decimal(myTreeView.GetNodeCount(true))), new Decimal(100)); // Display the tree node path and the number of child nodes it and the // tree view have. MessageBox.Show("The '" + myTreeView.get_SelectedNode().get_FullPath() + "' node has " + ((Int32)myNodeCount).ToString() + " child nodes.\nThat is " + String.Format("{0:###.##}", myChildPercentage) + "% of the total tree nodes in the tree view control."); } //myButton_Click
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ