Gil Fisher
April 13th, 1999, 08:04 AM
There is plenty of information on placing and using controls on dialog boxes. I need to use them on the documnet. I have placed two scroll bars, a button and a static controls on the documnet window. My problem is this: When I try to color the text in the static control by overiding the WM_CTLCOLOR message it does not work. The code is as follows:
HBRUSH MCtrl_DSCUStatic::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
// THis is the reflected one
CBrush hbr;
hbr.CreateSolidBrush( RGB(100,100,100));
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(255,0,0));
pDC->MoveTo(0,0);
pDC->LineTo(200,200);
// TODO: Return a non-NULL brush if the parent's handler should not be called
// return NULL;
return hbr;
}
This function does get called and the line gets drawn then the text prints over the line but the color is still black. So far the only soultion I have is to overide the onpaint function. This basically defeats the purpose of using a static control. Any suggestions? I would also like any information on using controls on a doc window. There is absolutly no info on this! Thanks!
Gil Fisher
HBRUSH MCtrl_DSCUStatic::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
// THis is the reflected one
CBrush hbr;
hbr.CreateSolidBrush( RGB(100,100,100));
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(255,0,0));
pDC->MoveTo(0,0);
pDC->LineTo(200,200);
// TODO: Return a non-NULL brush if the parent's handler should not be called
// return NULL;
return hbr;
}
This function does get called and the line gets drawn then the text prints over the line but the color is still black. So far the only soultion I have is to overide the onpaint function. This basically defeats the purpose of using a static control. Any suggestions? I would also like any information on using controls on a doc window. There is absolutly no info on this! Thanks!
Gil Fisher