Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC10.0
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 29-May-11 19:23pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You need to subclass it (click here[^] for a great subclassing article by Chris Maunder)
 
And within your new button callback, process WM_SETFOCUS[^]
  Permalink  
Comments
Stephen Wiria at 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)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 DamithSL 165
4 Tomas Takac 144
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 30 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100