HBRUSH CMyEditView::CtlColor(CDC* pDC, UINT nCtlColor) { // TODO: Change any attributes of the DC here if (nCtlColor==CTLCOLOR_STATIC) { pDC->SetBkMode(TRANSPARENT); pDC->SetBkColor(RGB(105,191,53)); pDC->SetTextColor(RGB(255,0,0)); return (HBRUSH)m_brush; } // TODO: Return a non-NULL brush if the parent's handler should not be called return NULL; }
在里面调用pDC->SetBkMode(TRANSPARENT);
或者,你在你的OnEraseBkgnd中调用pDC->SetBkMode(TRANSPARENT);
还有,ON_WM_CTLCOLOR_REFLECT好像只能在对话框里调用吧,试图里好像调用不了
{
// TODO: Change any attributes of the DC here
if (nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetBkColor(RGB(105,191,53));
pDC->SetTextColor(RGB(255,0,0));
return (HBRUSH)m_brush;
}
// TODO: Return a non-NULL brush if the parent's handler should not be called
return NULL;
}