It is not possible to set the background colour of check boxes and radio buttons for the standard Windows controls. These are drawn internally by the system.
The only solution would be to use owner drawn controls. But this is quite difficult for the check and radio markers.
See also my answer to a similar question for check boxes:
How do I change the background colour of a checkbox in MFC?[
^].
But drawing radio buttons is more sophisticated because you have to determine the circle and bullet dimensions for filling with the background colour and drawing the bullet in a similar style as done by the system.
Some information if you still want to do it:
- Draw the unchecked button using other styles as appropriate (
DrawThemeBackground
resp. CDC:DrawFrameControl
)
- Get the rect of the button
- Reduce the rect by 2 pixels in each dimension to get the rect for the background
- Special case: When hover glove is active, reduce rect by 4 pixels
- Fill the background using
CDC::Ellipse
with solid pen and brush set to the background colour
- The rect size for the bullet is the button rect reduced by 3 pixels with themed applications or 4 pixels with classic controls
- The resulting width is usually 13 with themed apps. Then decrement the left position and increment the bottom position
- Colour is
COLOR_WINDOWTEXT
(active) or COLOR_BTNSHADOW
(disabled) for classic style
- With themed app use
GetThemeColor()
to get the colour for BP_RADIOBUTTON
, the button style, and TMT_FILLCOLORHINT
- Draw the bullet using
CDC::Ellipse
with solid pen and brush set to the background colour
Note that the above does not draw a shaded / gradient bullet with active themes.