问题描述
具有自定义节点高度的TVirtualStringTree对象,如何可靠地将Virtual TreeView滚动到底部(即滚动条到底部)?
A TVirtualStringTree object with custom node height, How to reliably scroll Virtual TreeView to the bottom (i.e. the scrollbar gets to the bottom)?
我尝试调用 tree1.FullExpand
然后 tree1.ScrollIntoView。(tree1.GetLast)
,但不起作用。
I tried calling tree1.FullExpand
then tree1.ScrollIntoView.(tree1.GetLast)
, but it does not work.
提前谢谢。
推荐答案
ScrollIntoView适用于我。您还可以尝试 tree1.FocusedNode:= tree1.GetLast;
ScrollIntoView works well for me. You can also try tree1.FocusedNode := tree1.GetLast;
您是否在OnMeasureItem事件中设置自定义节点高度?
如果不起作用,尝试将树的DefaultNodeHeight设置为较大的值,并在OnMeasureItem事件中将其更改为较低。我注意到树更好地重新计算滚动条的长度。
Are you setting custom node height in OnMeasureItem event?If it doesn't work, try to set tree's DefaultNodeHeight to the bigger value and in OnMeasureItem event change it to lower. I noticed that tree recalculates scrollbar's length better that way.
这篇关于如何可靠地将Virtual TreeView滚动到底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!