Click here to Skip to main content
15,860,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted

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
 
Share this answer
 
You need to subclass it (click here[^] for a great subclassing article by Chris Maunder)

And within your new button callback, process WM_SETFOCUS[^]
 
Share this answer
 
Comments
Stephen Wiria 31-May-11 20:09pm    
Strange, why downvoted my solution?
I guess either the guy who downvoted me doesn't understand at all (if you want a complete sample, just ask!) or just goofing around. Silly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900