How to reliably scroll Virtual TreeView to the bottom?

A TVirtualStringTree object with custom node height, How to reliably scroll Virtual TreeView to the bottom (ie the scrollbar gets to the bottom)?

I tried calling tree1.FullExpand then tree1.ScrollIntoView.(tree1.GetLast) , but it does not work.

Thank you in advance.


ScrollIntoView works well for me. You can also try tree1.FocusedNode := tree1.GetLast;

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.


尝试这个:

SendMessage(VST.Handle, WM_VSCROLL, SB_BOTTOM, 0);
PostMessage(VST.Handle, WM_VSCROLL, SB_BOTTOM, 0);

这也应该工作:

tree1.TopNode := tree1.GetLast
链接地址: http://www.djcxy.com/p/34996.html

上一篇: 父节点隐藏时显示子节点

下一篇: 如何可靠地将虚拟TreeView滚动到底部?