如何在Mfc中取消按钮的焦点 [英] How Do I Unset The Focus Of Buttons In Mfc

查看:727
本文介绍了如何在Mfc中取消按钮的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过单击某个按钮使用DoModal调用对话框,但不禁用按钮焦点。它是专注的。任何解决方案??

I am invoking a dialog using DoModal by clicking some button, but the button focus is not disabled. It is focused. Any solutions ??

推荐答案

没有取消焦点这样的事情。你只能专心。原因如下:焦点总是意味着键盘焦点;它仅适用于可直接处理键盘输入的控件。整个桌面只有一个重点。应用程序创建了他们有自己专注的错觉,但这只是行为:当一些顶级窗口被停用时,好的应用程序会记住聚焦控件并在激活它时恢复焦点。



因此,要从某些控制中移除焦点,您只需要关注其他内容。这里: https://msdn.microsoft.com/en-us/library/0572xdb4.aspx [ ^ ]。



-SA
There is no such thing as "unset the focus". You can only focus. Here is why: the "focus" always means "keyboard focus"; it is only applicable to the control which can handle keyboard input directly. There is only one focus on the whole desktop. Application create the illusion that they have their own focus, but this is only the behavior: when some top-level window is deactivated, the good application remembers the focused control and restores the focus when it is activated.

Therefore, to remove the focus from some control, you simply need to focus something else. Here: https://msdn.microsoft.com/en-us/library/0572xdb4.aspx[^].

—SA


这篇关于如何在Mfc中取消按钮的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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