如果整个标题当前不可见,MFC 的 CTreeCtrl 如何自动显示包含项目标题的工具提示?

发布于 2024-10-08 07:08:49 字数 333 浏览 1 评论 0原文

背景 http://msdn.microsoft.com/en -us/library/b17bescz(v=VS.90).aspx “TVS_NOTOOLTIPS 样式禁用树视图控件的自动工具提示功能。如果整个标题当前不可见,此功能会自动显示工具提示,其中包含鼠标光标下的项目的标题。”

问题: CTreeCtrl 的默认功能(即每当项目被截断时,自动显示标题的工具提示)在 MFC 代码中实际实现的位置在哪里(例如哪个文件)?

谢谢

Background http://msdn.microsoft.com/en-us/library/b17bescz(v=VS.90).aspx
"The TVS_NOTOOLTIPS style disables the automatic tool tip feature of tree view controls. This feature automatically displays a tool tip, containing the title of the item under the mouse cursor, if the entire title is not currently visible."

Question: Where is this default feature [i.e. whenever the item is cutoff, auto show tooltip of the title] of the CTreeCtrl actually implemented in the MFC code (e.g. which file)?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的背包 2024-10-15 07:08:49

工具提示是 Win32 树控件固有的。 CTreeCtrl 是一个简单的包装器。唯一可以找到该代码的地方是 Microsoft。

The tooltip is inherent in the Win32 Tree Control. The CTreeCtrl is a simple wrapper. The only place to find the code for that is from Microsoft.

此岸叶落 2024-10-15 07:08:49

实现这个应该相对简单。

捕获treectrl中的鼠标移动(OnMouseMove)

  1. 获取当前光标位置
  2. 获取光标下的项目(treectrl.HitTest)
  3. 获取项目的显示矩形(treectrl.GetItemRect)
  4. 获取treectrl的显示矩形(treectrl.GetClientRect)
  5. 如果项目的显示矩形右侧> treectrl 的显示矩形 --> SHOW TOOLTIP AT (item.left, item.top)
  6. 如果项目显示矩形的左侧 < treectrl 的显示矩形 -->显示工具提示于 (treectrl.left, item.top)

不知道这是否有帮助。我在 MFC 应用程序中做了非常类似的事情来进行专业突出显示。

It should be relatively straightforward to implement this.

Capture mouse move in treectrl (OnMouseMove)

  1. Get current cursor position
  2. Get item under cursor (treectrl.HitTest)
  3. Get item's display rect (treectrl.GetItemRect)
  4. Get treectrl's display rect (treectrl.GetClientRect)
  5. If right side of item's display rect > treectrl's display rect --> SHOW TOOLTIP AT (item.left, item.top)
  6. If left side of item's display rect < treectrl's display rect --> SHOW TOOLTIP AT (treectrl.left, item.top)

Dunno if this helps. I do a very similar thing in an MFC app to do specialist highlighting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文