Click to See Complete Forum and Search --> : How to change background color of a Static text ?


kingofmerit
October 15th, 2004, 05:52 AM
Hi ! I am a beginner of Visual C++.
In my project, there is a Static text named IDC_STATICTIME,
I put a timer on it. And I want to change the background color of the static (TRANSPARENT) by OnCtlColor method.
Here is the code :

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

pDC->SetBkMode(TRANSPARENT);

if (pWnd->GetDlgCtrlID() == IDC_STATICTIME)
{
pDC->SetTextColor(RGB(0, 0, 255));
pDC->SetBkMode(TRANSPARENT);
}

return hbr;
}

It changes only the text color, the background color is not !
What will I do in order to change the background color of the static ?
Please help me.
Thank you very much.

indiocolifa
October 26th, 2004, 05:41 AM
Just use

pDC->SetBkMode(OPAQUE)

I think it can work in this form.