Changing text color of radio buttons and group boxes
OK this is stupid and probably has been answered a hundred times, but I've searched and I can't seem to find the answer.
I have a dialog based app with a dark background. I want to set all the text in the dialog to a light color so it can be seen against the dark background. So far I've done this for most controls using this code...
Code:
HBRUSH CMyAppDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
switch (nCtlColor)
{
case CTLCOLOR_BTN:
case CTLCOLOR_DLG:
return CreateSolidBrush(BACKGROUND_COLOR);
case CTLCOLOR_STATIC:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(TEXT_COLOR);
return CreateSolidBrush(BACKGROUND_COLOR);
default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
}
However the radio buttons and group box labels change their background color but not their text color. Am I missing something obvious here?
Attached is a small screen shot of what I'm getting. As you can see the standard labels (i.e. Fade-in and Fade-out) change color correctly, but the group box labels and radio button text do not.
The text color of the radio buttons and group boxes still did not change. I did some more Googling and found a few references that suggest that this might not work when using a manifest to get the newer style controls. Does anyone know if this is the case?
Re: Changing text color of radio buttons and group boxes
I answered my own question. Turns out that the manifest/theme does prevent you from changing the text color of check boxes, radio button and group boxes. I'm in a bit of a hurry and didn't want to have to subclass all the controls to fix this so I simply turned off the themes on these controls using this code in OnInitDialog...
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.