Click here to Skip to main content
15,904,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to custom treeview scrollbar style,so i develop a scrollbar control,but i dont't know how to linkage scroll TreeView by custom scrollbar
Posted

1 solution

Try This:
C#
vScrollBar1.Minimum = 0;
vScrollBar1.Maximum = treeView1.Nodes.Count;
vScrollBar1.Scroll += vScrollBar1_Scroll;

void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
    treeView1.Nodes[e.NewValue].EnsureVisible();
}

Note: that the Maximum value of the Scrollbar must be treeview node count, as it uses the EnsureVisible method on the specified node...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900