从Button中删除默认选择矩形 [英] Removing the default selcetion rectangle from Button

查看:115
本文介绍了从Button中删除默认选择矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家,
我需要删除在MFC中单击鼠标后将显示的默认选择矩形.我认为这是确定最后一个交互控件的默认机制.我要删除此选择.可以吗?请帮帮我..

谢谢,
Satheesh ..

Hi Experts,
I need to remove the default selection rectangle that will show after a mouse click in MFC. I think this is a default mechanism to idetify which is the last interacted control. I want to remove this selection.Is it possible? Please help me..

Thanks,
Satheesh..

推荐答案

不!按钮有两种状态:一种显示按钮为默认,另一种状态显示按钮当前是否具有输入焦点.如果它具有输入焦点,则表示如果您单击空白,它将询问为单击".如果是默认设置,即使键盘焦点在其他位置,如果您按Enter键也将执行此操作.

这是您不想删除的非常重要的视觉反馈.

但是,如果您确实想允许这种违反通用UI样式的行为,则可以执行以下操作:1)添加按钮样式BS_OWNERDRAW并根据自己的喜好执行所有者绘制,2)创建一个按钮无法聚焦.

-SA
No! There are two states of the button: one shows that the button is default, another state shows if it currently has input focus. If it has input focus, it indicated that it will ask as "click" if you hit blank space. If it is default, it will do it if you hit Enter even if the keyboard focus is somewhere else.

This is very important visual feedback you don''t want to remove.

However, if you really want to allow such violation of the common UI style, you can do the following: 1) Add button style BS_OWNERDRAW and perform owner draw at your liking, 2) make a button non-focusable.

—SA


您需要对其进行子类化(单击此处 [ ^ ] Chris Maunder撰写的很棒的子类化文章)

在您的新按钮回调中,处理 WM_SETFOCUS [ ^ ]
You need to subclass it (click here[^] for a great subclassing article by Chris Maunder)

And within your new button callback, process WM_SETFOCUS[^]


这篇关于从Button中删除默认选择矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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