Problem with Dropdownlist Combo box
Simple Question first What is the Difference between CWnd::CtlColor and CWnd::OnCtlColor?
my real problem is that I am creating a flat combobox for an application with some success. I am able to change the color of text and background and overall appearance by handling WM_PAINT and WM_CTLCOLOR messages but when my Combo box style is set to CBS_DROPDOWMLIST, I cannot change the background color or the Text colot in then Static control display window. anyone has suggestions?
CFlatCombo::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetTextColor(m_crText);
pDC->SetBkColor(m_crBkColor);
pDC->SetBkMode(TRANSPARENT);
//The value of this brush is set in CFLatCombo::SetBkColor
return m_brBkgnd;
}
CFlatCombo::OnPaint()
{
// Most of the Drawing is omitted
CPaintDC dc(this);
CRect rcCombo;
PAINTSTRUCT ps;
BeginPaint(&ps);
GetClientRect(&rcCombo);
CBrush* pBkBrush = new CBrush(m_crBkColor);
CPen* pBkPen = new CPen(PS_SOLID, 1, RGB(0,0,0));
CBrush* pOldBrush = dc.SelectObject(pBkBrush);
CPen* pOldPen = dc.SelectObject(pBkPen);
dc.Rectangle(rcCombo);
EndPaint(&ps);
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
delete pBkBrush;
delete pBkPen;
}