Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box Color Problem

Status
Not open for further replies.

paul51

Programmer
May 19, 2000
38
0
0
US
I am trying to change color of a check box control several times in my program. I am using the following code:

HBRUSH CColortestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

if(pWnd==GetDlgItem(IDC_CHECK1))
{
pDC->SetTextColor(RGB(0,0,1750));
}
//this is set at some later time to change the color of the check box to green.
if(color_bit == 0)
{

if(pWnd==GetDlgItem(IDC_CHECK1))
{
pDC->SetTextColor(RGB(0,255,0));
}
}
}

This does change the color during initialization of the program, but I cannot call the function OnCtlColor whenever I want in order to change the text color. Does anyone know hte command to repaint the dialog, or how I can call the OnCtlColor class?
 
Hello BlackDice,

Invalidate(TRUE) works properly. Thank you for your help. I greatly appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top