Actually a combo box consists of an edit box and list box.
So you have to set the color for both list box and edit box.
See the sample snippet
if( nCtlColor == CTLCOLOR_LISTBOX ) if( nCtlColor == CTLCOLOR_EDIT)
pDC->SetTextColor( RGB(0xFF,0,0));
pDC->SetTextColor( RGB(0xFF,0,0));
Thanks Sharath for your response!
Actually this message is generated for a DTP control only when I click inside the combo part of the control and the font color change persist only as long as the focus is on the combo part. I want the changed font color throughout the application life cycle. OnCtlColor works fine for other controls like edit box, combo box, list box, static control etc.
I've tried implementing both CtlColor() and OnCtlColor() using Class Wizard and neither even get called in the debugger.
I have no problem with OnEraseBkgnd() and it seems to be painting the backgrounds just fine.
CTLCOLOR_EDIT and CTLCOLOR_LISTBOX probably do not apply to a Date and Time Picker since
1. There is no List Box, and
2. DTM_SETMCCOLOR is used to set the colors in the month drop down, the equivalent of a combo bo drop down.
and this is only useful in order to paint different colours for the edit control and the list box anyways.
However, like a combobox, perhaps it is possible to get access to the edit control itself somehow.