TreeView for WinForms | ComponentOne
In This Topic
    Tree Lines
    In This Topic

    Tree lines, as the name suggests, are the lines connecting the nodes of a treeview displaying the relationship between parent and child nodes clearly.

    TreeView allows you to display or hide the tree lines by setting the ShowLines property provided by the TreeViewStyles class to true or false. In addition, the control enables you to perform customizations, as follows:

    The following image shows TreeView with the tree lines customized with respect to their color, width, and style.

    TreeView with customized tree lines

    The following code snippet enables the visibility of the tree lines and customizes them in terms of their width, color, and style.

    'set the ShowLines property
    C1TreeView1.Styles.ShowLines = True
    
    'set the LinesWidth property
    C1TreeView1.Styles.LinesWidth = 2
    
    'set the LinesColor proprerty
    C1TreeView1.Styles.LinesColor = System.Drawing.Color.Orange
    
    ' set the LinesStyle property
    C1TreeView1.Styles.LinesStyle = Drawing2D.DashStyle.Solid
    
    // set the ShowLines property
    c1TreeView1.Styles.ShowLines = true;
    
    // set the LinesWidth property
    c1TreeView1.Styles.LinesWidth = 2;
    
    // set the LinesColor proprerty
    c1TreeView1.Styles.LinesColor = System.Drawing.Color.Orange;
    
    // set the LinesStyle property
    c1TreeView1.Styles.LinesStyle = System.Drawing.Drawing2D.DashStyle.Solid;