CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2004
    Posts
    119

    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.

    Thanks,
    Dan
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured