TreeView.LineColor Property

Definition

Gets or sets the color of the lines connecting the nodes of the TreeView control.

C#
public System.Drawing.Color LineColor { get; set; }

Property Value

The Color of the lines connecting the tree nodes.

Examples

The following code example demonstrates setting the TreeNode line color. To run this example, paste the code into a Windows Form. Call InitializeLineTreeView from the form's constructor or Load event handler.

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

Applies to

Proizvod Verzije
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10