nouser
August 13th, 1999, 01:34 AM
Anybody know a quick and simple way to change the background color of a CStatic control? If you do please include a snip-it of code in reply.
|
Click to See Complete Forum and Search --> : Change CStatic Background Color? nouser August 13th, 1999, 01:34 AM Anybody know a quick and simple way to change the background color of a CStatic control? If you do please include a snip-it of code in reply. Jason Teagle August 13th, 1999, 02:10 AM This topic has been covered many, many times. Override the static's parent's OnCtlColor() like this: --- HBRUSH CSomeWndOrDlg::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor) { HBRUSH hBrBkgnd = CBaseClass::OnCtlColor(pDC, pWnd, nCtlColor); if (nCtlColor == CTLCOLOR_STATIC) { hBrBkgnd = get_your_HBRUSH_for_back_colour_here ; pDC->SetBkColor(same_colour_as_above_but_as_COLORREF); } return hBrBkgnd ; } --- OK? codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |