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?
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?