|
-
May 14th, 1999, 12:35 PM
#1
How do I change the background color of CListBox
I tried this but nothing happens:
HBRUSH CACUSHusPP::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if ( nCtlColor == CTLCOLOR_LISTBOX )
hbr = (HBRUSH)(LTGRAY_BRUSH);
// TODO: Return a different brush if the default is not desired
return hbr;
}
How is it done?
D.B.
-
May 17th, 1999, 03:03 AM
#2
Re: How do I change the background color of CListBox
Use this instead
HBRUSH CACUSHusPP::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if ( nCtlColor == CTLCOLOR_LISTBOX )
pDC->SetBkColor(GetSysColor(LTGRAY_BRUSH));
// TODO: Return a different brush if the default is not desired
return hbr;
}
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
|