If you just add nodes without any following selection / expansion /
ensurevisible
there is no way it would scroll.
Ensure that you do nothing when adding nodes and possibly use addrange
(which is much faster, as it would not fire events after each node
addition)
Finally, if you want to really cut away any problem you can do just one
simple thing:
Me.TreeView1.Scrollable = False
'YOUR CODE HERE ...
Me.TreeView1.Scrollable = True
this will prevent scrolling during the treeview building.
-t
(PeteCresswell) ha scritto:
Quote:
Per
tommaso.gastaldi@uniroma1.it:
Quote:
Actually the behavior you report is not the default. You are probably
doing some "EnsureVisible" after adding a node, to cause the scroll.
Remove it, to avoid scrolling. If possible use .addrange and do node
selection / ensurevisible when finished adding nodes. Let me know...
>
I did find/eliminate a .EnsureVisible - but it was in the Expand/Collapse All
routine that I had in place. And, indeed, after invoking that routine the
tree's horizontal scroll is now positioned so that the high-level plus signs are
visible as long as it was so positioned in the first place (it was indeed
getting scrolled with the .EnsureVisible applied..)
>
But .EnsureVisible does not seem to be the culprit when I'm building the tree
and haven't done any Expand/Collapse on it yet - at least when I do a "Find" on
the code for .EnsureVisible, there aren't any hits.
>
Gave .vScrollPolicy = "Off" a try, but that prop doesn't seem to exist on the
ComCtl tree.
>
--
PeteCresswell