更改CComboBox的边框颜色以显示错误和警告(Change border color of CComboBox to show error and warning)
我在我的项目中使用CComboBox。 我想在焦点上更改边框组合框的颜色
I am using CComboBox in my project. I want to change the color of the border combo box on focus
最满意答案
最后它完成了,它有一个非常简单的解决方案。 我刚刚覆盖了控件的onpaint方法。
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; }Finally 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; }更多推荐
CComboBox,color,change,电脑培训,计算机培训,IT培训"/> <meta name="descri
发布评论