Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I was thinking of using mfc's radio button for some status lights in an application since the shape is essentially already what I want. Changing the color of the round portion of the radio button however, seems like not as trivial of a task as I assumed it might be. Does anyone know of any way of doing this other than overriding DrawItem()?

Problem with overriding DrawItem() is that essentially I'm having to recreate by hand the entire button just to override the color, seems like defeating the purpose of using that as a base.
Posted
Updated 6-Jun-11 5:45am
v2
Comments
Resmi Anna 7-Jun-11 2:10am    
did you try in OnCtlColor()
here you can set the color for radio button text, radio button text background, radio button control background. but you can not set color for that round frame of your radio button.
Albert Holguin 7-Jun-11 11:20am    
You change most of the colors there except the one I want to change, the circular container itself...
Febil Chacko Thanikal 7-Jun-11 4:40am    
http://social.msdn.microsoft.com/Forums/en-SG/vssmartdevicesnative/thread/48afc8d3-8ecd-4280-bdc7-a3594745207d
Albert Holguin 7-Jun-11 11:24am    
thanks for the link, but that's all stuff both me and resmi have already covered, pretty much sounds like drawing it myself is the only option... in which case its probably easier to make it a CStatic

you can subclass the control and make some ownerdrawn operations
 
Share this answer
 
Comments
Albert Holguin 9-Jun-11 10:27am    
hmm... you mean override the DrawItem()? ...cause I'm pretty sure that's exactly what's already written in my question...
but you are wrong. Read and unterstand this fine article:
Create your own controls - the art of subclassing[^][^]
 
Share this answer
 
Comments
Albert Holguin 9-Jun-11 10:50am    
how am I wrong? ...and I see you insist on adding new solutions for every comment...
Albert Holguin 9-Jun-11 10:53am    
...and thanks for the article, but I know how to do all that without wizards...
KarstenK 14-Jun-11 3:12am    
You only need to extract the drawing code. Dont forget the Message Macros in the message map.

Sorry for "adding new solutions", i havnt answered a long question here..

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