防止MFC应用程序将光标更改回默认图标 [英] Prevent MFC application to change cursor back to default icon

查看:150
本文介绍了防止MFC应用程序将光标更改回默认图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个应用程序,该应用程序根据光标在窗口客户区域中的位置来更改光标.但是我注意到,当我单击鼠标左键时,光标会变回默认的箭头图标.

I have written an application which changes the cursor depending on its position within the window client area. However I have noticed that when I click on the left mouse button the cursor changes back to default arrow icon.

我已经覆盖了afx_msg void CWnd::OnLButtonDown(),并且没有在其中调用任何基类函数(它完全为空).

I have overridden the afx_msg void CWnd::OnLButtonDown() and do not call any of the base class function in it (it's completely empty).

任何想法都可能导致CDialogEx将游标改回原来的位置吗?是什么处理左键单击消息?

Any idea what might cause CDialogEx to change the cursor back? What handles the the left click message?

推荐答案

通常,您需要覆盖OnSetCursor(),如果鼠标在需要特定光标的位置,则可以调用SetCursor(),然后返回TRUE,这样DefWindowProc不会将其重置为默认箭头.

Usually, you need to override OnSetCursor(), and there, if the mouse is in a place where you want a specific cursor, you call SetCursor() and return TRUE so that DefWindowProc doesn't reset it back to the default arrow.

这篇关于防止MFC应用程序将光标更改回默认图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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