How do I ensure the last TreeNode (in a TreeView) is fully visible?
I'm using a TreeView control and adding nodes programatically. Because I want my last node to always be visible (ie. automatically scroll the treeview) I am calling TreeNode.EnsureVisible() on the last node.
However, if the node is only a tiny, tiny bi开发者_如何学Ct visible (ie. just a sliver) it is considered visible. If I try to scroll the TreeView it still doesn't show me the last node.
How can I make sure my last TreeNode is 100% visible?
I was looking for the similar problem and I found this page:
http://support.microsoft.com/kb/814354
The page acknowledges that its a bug and the workaround is calling BeginUpdate() and EndUpdate() methods:
TreeView1.BeginUpdate()
TreeView1.Nodes.Add("test")
TreeView1.EndUpdate()
Nirmal
精彩评论