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.
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;
}