加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – VirtualTreeView:检查节点是否可见

发布时间:2020-12-15 09:14:33 所属栏目:大数据 来源:网络整理
导读:如何使用VirtualTreeView组件检查节点是否可见(在屏幕上)?像这样的东西: if not Grid.NodeVisible (Node) then Grid.ScrollIntoView (Node,True); 如果节点不可见,则该节点应居中,但如果节点可见则保持在该位置. 请注意,我不是在谈论节点的可见标志,而是关
如何使用VirtualTreeView组件检查节点是否可见(在屏幕上)?像这样的东西:

if not Grid.NodeVisible (Node) then
   Grid.ScrollIntoView (Node,True);

如果节点不可见,则该节点应居中,但如果节点可见则保持在该位置.

请注意,我不是在谈论节点的可见标志,而是关于屏幕上的可见性.
在我的例子中,IsVisible属性总是返回True.

解决方法

我认为最接近的是GetDisplayRect()方法:

Determines the client coordinates the given node covers,depending on scrolling,expand state etc.
If the given node cannot be found (because one of its parents is collapsed or it is invisible) then an empty
rectangle is returned.

如果节点“可见但不可见”,则不确定它返回的内容 – 您可能必须编写辅助函数,该函数检查VT的客户端矩形内的返回rect …

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读