Custom coloring of CComboBox with drop list style doesn't work on Windows Server 2012 (and Windows 8

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
In our program we highlight combo box that have to be filled with yellow background.
This worked quite well with code similar to this until now:
BEGIN_MESSAGE_MAP(MyCb, CComboBox)
ON_WM_CTLCOLOR_REFLECT()
END_MESSAGE_MAP()
HBRUSH MyCb::CtlColor(CDC* pDC, UINT nCtlColor)
{
// yellow -> sets the color of the upper part
pDC->SetBkColor(RGB(255,255,0));
pDC->SetBkMode(TRANSPARENT);

// m_brush2 -> not used.
return m_brush2;
}
But on Windows Server 2012 the upper part is not coloured anymore (it works well if style is Dropdown, but not for Drop List).
Any ideas for workarounds?
Thanks, Thomas

View the full article
 
Back
Top