I am using CComboBox
with style DropDown wherein user can enter data in edit area in case expected option is not available in the drop down options.
I am trying to set color of text present in Editable area using OnCtlColor
but it sets color to only drop down items inserted and not the editable area.
HBRUSH CUserInfoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
int iCtrlID;
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
iCtrlID = pWnd->GetDlgCtrlID();
if (CTLCOLOR_STATIC == nCtlColor &&
(IDC_CMB_CITY == iCtrlID)
)
{
pDC->SetTextColor(RGB(255, 0, 0));
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH) GetStockObject(WHITE_BRUSH);
}
if (CTLCOLOR_EDIT == nCtlColor &&
(IDC_CMB_CITY == iCtrlID)
)
{
pDC->SetTextColor(RGB(255, 0, 0));
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
where IDC_CMB_CITY
is resource ID of CComboBox
control.