Partager via


TreeView.LineColor Propriété

Définition

Obtient ou définit la couleur des lignes qui connectent les nœuds du contrôle TreeView.

public:
 property System::Drawing::Color LineColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color LineColor { get; set; }
member this.LineColor : System.Drawing.Color with get, set
Public Property LineColor As Color

Valeur de propriété

Color des lignes qui connectent les nœuds d'arbre.

Exemples

L’exemple de code suivant illustre la définition de la couleur de TreeNode ligne. Pour exécuter cet exemple, collez le code dans un Windows Form. Appelez InitializeLineTreeView à partir du constructeur ou Load du gestionnaire d’événements du formulaire.

private:
    TreeView^ lineTreeView;

public:
    void InitializeLineTreeView()
    {
        lineTreeView = gcnew TreeView();
        lineTreeView->Size = System::Drawing::Size(200, 200);

        lineTreeView->LineColor = Color::Red;

        // Create the root nodes.
        TreeNode^ docNode = gcnew TreeNode("Documents");

        // Add some additional nodes.
        docNode->Nodes->Add("phoneList.doc");
        docNode->Nodes->Add("resume.doc");

        lineTreeView->Nodes->Add(docNode);
        this->Controls->Add(lineTreeView);
    }
private TreeView lineTreeView;
public void InitializeLineTreeView()
{
    lineTreeView = new TreeView();
    lineTreeView.Size = new Size(200, 200);

    lineTreeView.LineColor = Color.Red;

    // Create the root nodes.
    TreeNode docNode = new TreeNode("Documents");
   
    // Add some additional nodes.
    docNode.Nodes.Add("phoneList.doc");
    docNode.Nodes.Add("resume.doc");
    
    lineTreeView.Nodes.Add(docNode);
    Controls.Add(lineTreeView);
}
Private lineTreeView As TreeView

Public Sub InitializeLineTreeView() 
    lineTreeView = New TreeView()
    lineTreeView.Size = New Size(200, 200)
    
    lineTreeView.LineColor = Color.Red
    
    ' Create the root nodes.
    Dim docNode As New TreeNode("Documents")
    
    ' Add some additional nodes.
    docNode.Nodes.Add("phoneList.doc")
    docNode.Nodes.Add("resume.doc")
    
    lineTreeView.Nodes.Add(docNode)
    Controls.Add(lineTreeView)

End Sub

S’applique à