Click to See Complete Forum and Search --> : Problem with changing color of Static box


Samanta
March 29th, 1999, 09:55 AM
Hello

HBRUSH COptionsDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)

{

HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here

CWnd* StaticWnd;

StaticWnd = GetDlgItem(IDC_COLORPICK);

if(nCtlColor == CTLCOLOR_STATIC && StaticWnd == pWnd)

MessageBox("Static color event");

// TODO: Return a different brush if the default is not desired

return hbr;

}

The if statement is always FALSE, and i can't grab my Static box to change it color...

please help me

Thank You


P.S.

also i don't know what is the way of changing color of this static control...maybe fillsolidrect????

Nambi
March 29th, 1999, 10:59 PM
Hi,


Compare the window handles.


And to change the color of the static box, create a brush using CBrush().


Good Luck.