Change border color of CComboBox to show error and warning

1k Views Asked by At

I am using CComboBox in my project. I want to change the color of the border combo box on focus

1

There are 1 best solutions below

2
On BEST ANSWER

enter image description hereFinally it is done and it has a very easy solution. I just overridden the onpaint method of the control.

void CComboBoxOwn::OnPaint()
{
CDC *dc = m_Parent->combobox->GetDC();
CRect rc; 
m_Parent->combobox->GetClientRect(rc);
HBRUSH hBrush = CreateSolidBrush(COLORREF(RGB(255, 0, 0)));
FrameRect(dc->m_hDC, rc, hBrush);
DeleteObject(hBrush);
ReleaseDC(dc);

return;
}