TreeNode.FullPath, propriété (System.Windows.Forms)

Bibliothèque de classes .NET Framework 
TreeNode.FullPath, propriété 

Obtient le chemin d'accès du n?ud d'arbre racine au n?ud d'arbre en cours.

Espace de noms : System.Windows.Forms
Assembly : System.Windows.Forms (dans system.windows.forms.dll)

SyntaxeSyntaxe


Visual Basic (Déclaration)
Public ReadOnly Property FullPath As String


Visual Basic (Utilisation)
Dim instance As TreeNode
Dim value As String

value = instance.FullPath


C#
public string FullPath { get; }


C++
public:
property String^ FullPath {
    String^ get ();
}


J#
/** @property */
public String get_FullPath ()


JScript
public function get FullPath () : String

Valeur de la propriété

Chemin d'accès du n?ud d'arbre racine au n?ud d'arbre en cours.
ExceptionsExceptions
Type d'exceptionCondition

InvalidOperationException

Le n?ud n'est pas contenu dans un TreeView.

NotesNotes

Le chemin d'accès est constitué des étiquettes de tous les n?uds d'arbre qui doivent être explorés pour obtenir ce n?ud d'arbre en commençant au n?ud d'arbre racine. Les étiquettes de n?ud sont séparées par le caractère délimiteur spécifié dans la propriété PathSeparator du contrôle TreeView qui contient le n?ud. Par exemple, si le caractère délimiteur du contrôle TreeView appelé "Location" est la barre oblique inverse (\), la valeur de la propriété FullPath est "Country\Region\State".

ExempleExemple

L'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).



Visual Basic
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


C#
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.");
}


C++
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." ) );
}


J#
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-formesPlates-formes

Windows 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 versionInformations de version

.NET Framework

Prise en charge dans : 2.0, 1.1, 1.0

.NET Compact Framework

Prise en charge dans : 2.0, 1.0
Voir aussiVoir aussi

Ces informations proviennent du site de http://msdn2.microsoft.com
Source de cette page : http://msdn2.microsoft.com/fr-fr/library/system.windows.forms.treenode.fullpath.aspx

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

10 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-5877
Document créé le 30/10/06 01:25, dernière modification le Vendredi 17 Juin 2011, 12:11
Source du document imprimé : http://www.gaudry.be/dotnet-rf-system.windows.forms.treenode.fullpath.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,37 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Mieux vaut étudier que jeûner tout un jour et veiller toute une nuit pour méditer en vain.

Confucius
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 05:44, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)