|
-
August 13th, 1999, 01:34 AM
#1
Change CStatic Background Color?
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.
Last edited by nouser; April 18th, 2009 at 10:03 PM.
-
August 13th, 1999, 02:10 AM
#2
Re: Change CStatic Background Color?
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|