更新时间:2022-12-11 18:13:15
尝试这:
Try This:
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...