[英]How do I display dynamic text at the mouse cursor via C++/MFC in a Win32 application
我希望能够在 win32 应用程序中的鼠标 cursor 位置显示一些动态文本,例如给出一个 X,Y 坐标,该坐标将随着 cursor 移动,就像附加的一样。 I can do this during a mousemove event using a TextOut() call for the window at the mouse coordinates and invalidate a rectange around a stored last cursor position to clear up the previous output. 然而,这可能会受到闪烁的影响,并导致在 window 中绘制的其他事物(例如跟踪器框)出现问题。 有没有更好的方法来做到这一点,也许使用现有的 cursor 绘图/无效机制?
您可以通过 ToolTips 执行此操作 - 查看CToolTipCtrl 。
如果您想要无闪烁跟踪工具提示,那么您需要从使用trackActivate消息的 CToolTipCtrl 派生您自己的类。
您可能需要考虑一个小的透明 window,您可以移动它以跟随鼠标。 特别是,自从 Windows 2000 以来, 分层windows 似乎是首选武器(坦白:没有个人经验)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.