如何检测鼠标悬停在资源对话​​框中的对象上? [英] How can I detect the mouse hovering over an object in a resource dialog?

查看:77
本文介绍了如何检测鼠标悬停在资源对话​​框中的对象上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.


我在资源编辑器中创建了一个对话框,其中包含一些编辑控件和静态文本,我想知道用户何时将鼠标悬停在编辑控件上(因此我可以在框中输入有关键入内容的更多信息. ).我尝试在一些论坛上四处逛逛,但似乎找不到任何解决方案或想法.

因此,我想知道是否有人可以帮助我,或者提供一个链接来帮助说明如何解决问题.

最好的问候,
Anton.

解决方案

首先处理WM_MOUSEMOVE消息,以便您知道鼠标位于控件上方.
然后,调用TrackMouseEvent,当鼠标离开控件时,该事件将发布WM_MOUSELEAVE消息.特别是因为它是一个对话框.如果您使用的是MFC,请查看CToolTip类,或者使用纯Win32,然后在MSDN中搜索ToolTip.


Hi there.


I have a dialog created in the resource editor with some edit controls and static texts, and I''d like to know when the user hovers the mouse over an edit control (so I can print out more information about what to type in the box). I''ve tried looking around on some forums but can''t seem to get any solution or idea.

So I wonder if anyone can help me, or provide a link that helps to explain how I should get the problem solved.

Best regards,
Anton.

解决方案

First handle the WM_MOUSEMOVE message so you know that the mouse is over your control.
Then call TrackMouseEvent which posts a WM_MOUSELEAVE message when the mouse leaves the control.


You may find it easier to use a ToolTip to show the information, rather than checking for mouse movement; particularly as it is a Dialog. If you are using MFC take a look at the CToolTip class, or if pure Win32 then just search MSDN for ToolTip.


这篇关于如何检测鼠标悬停在资源对话​​框中的对象上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆