Changing background color of CComboBoxEx
..having a bit of a problem with this one..
-I've overridden the OnCtlColor method of CComboBoxEx, and changed the color of the background:
...
COLORREF ActiveBkColor =(COLORREF)0xdae4e9;
static CBrush ActiveBrush(ActiveBkColor);
HBRUSH Brush;
Brush = ActiveBrush;
pDC->SetBkColor(ActiveBkColor);
return Brush;
-Looks totally OK as long as I don't look at the popped-up list, where the background of the text (only) is still white!
-Where there is no TEXT, the background color is ok..
Does anybody have an idea as to what I can do?
Regards
/Torbjörn Josefsson
Re: Changing background color of CComboBoxEx
From MSDN documentation on CWnd::OnCtlColor:
OnCtlColor will not be called for the list box of a drop-down combo box because the drop-down list box is actually a child of the combo box and not a child of the window. To change the color of the drop-down list box, create a CComboBox with an override of OnCtlColor that checks for CTLCOLOR_LISTBOX in the nCtlColor parameter. In this handler, the SetBkColor member function must be used to set the background color for the text.
Re: Changing background color of CComboBoxEx
Hi,
would u be so kind and post your complete entry in the OnCtlColor?
I´ve the same problem and wonder how it works.
THX!!!!