Delphi VirtualTreeView如何实现节点可见性检查的详细方法?

2026-04-10 17:062阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计276个文字,预计阅读时间需要2分钟。

Delphi VirtualTreeView如何实现节点可见性检查的详细方法?

如何使用VirtualTreeView组件检查节点是否可见(在屏幕上)?例如,如下所示:

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

如果节点不可见,则将该节点滚动到视图中居中;如果节点可见,则保持其在‘中的位置。

如何使用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.

Delphi VirtualTreeView如何实现节点可见性检查的详细方法?

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

本文共计276个文字,预计阅读时间需要2分钟。

Delphi VirtualTreeView如何实现节点可见性检查的详细方法?

如何使用VirtualTreeView组件检查节点是否可见(在屏幕上)?例如,如下所示:

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

如果节点不可见,则将该节点滚动到视图中居中;如果节点可见,则保持其在‘中的位置。

如何使用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.

Delphi VirtualTreeView如何实现节点可见性检查的详细方法?

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