
Changing the background color of a static text control
I'm not calling CreateSolidBrush. Where is the appropriate spot to call
it. Here is a the code that I am using.
HBRUSH CBaseDialog::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
// Call the base class implementation first! Otherwise, it may
// undo what we're trying to accomplish here.
HBRUSH hbr = CDialog::OnCtlColor( pDC, pWnd, nCtlColor );
switch ( pWnd->GetDlgCtrlID() )
{
case IDC_TITLE:
{
// Set the text color to black
pDC->SetTextColor( RGB(0, 0, 0) );
pDC->SetBkColor( RGB(255, 255, 255) );
hbr = (HBRUSH) m_brush->GetSafeHandle();
}
break;
}
return hbr;
Quote:
}
Anthony
--
Product Availability Developer
Invensys Avantis - http://www.avantis.net
Production Management Division
Quote:
> > Thanks for pointing me in the right direction. I have it partially
> > working now. I have my text showing in the color I want, and the
> > background, but the rest of the area for the control is being displayed
in
> > black. I can't find the method that changes that color.
> Are you returning an HBRUSH or the proper color? How and when are you
doing
> the CreateSolidBrush?
> --
> Jeff Partch [VC++ MVP]