So I was trying to set a ComboBox's background & text color using Common-Controls & WINAPI. I did manage to set the background & text color of the combo box itself, but the colors of its dropdown list remain the same.
Here is pretty much what I did:
When creating the combo box, I used the CBS_DROPDOWNLIST style (along with WS_VISIBLE & WS_CHILD).
Then in the window handler function, I handled the CTLCOLOR_LISTBOX messge in the following way:
SetBkMode(dc, OPAQUE);
SetTextColor(dc, RGB(255, 255, 255));
SetBkColor(dc, 0x383838);
comboBrush = CreateSolidBrush(0x383838); //global var
return (LRESULT)comboBrush;
As I said, this only colors the combobox itself, and not its drop-down list. How can I can color the drop down list as well?
For the background color and text color of the combo box, you can handle the WM_CTLCOLORLISTBOX and WM_CTLCOLOREDIT messages respectively.
Some code:
Updated:
Change the background color by comparing the edit handle and listbox handle returned by the window.
Debug: