BOOL CQisiyixiang112View::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
pDC->SetBkColor(RGB(255,0,0));
return CView::OnEraseBkgnd(pDC);
}
函数不管用啊?
{
// TODO: Add your message handler code here and/or call default
pDC->SetBkColor(RGB(255,0,0));
return CView::OnEraseBkgnd(pDC);
}
函数不管用啊?
你可以在view视图类中添加一个CBrush brush;在view类的构造函数中初始化你想要的颜色,比如:
brush.CreateSolidBrush(RGB(255, 0, 0));添加view类的WM_CREATE消息响应函数,在OnCreate函数的return 0;语句之前加入如下语句即可:
SetClassLong(m_hWnd, GCL_HBRBACKGROUND, (LONG)brush.m_hObject);
BOOL CQisiyixiang112View::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBrush brush;
brush.CreateSolidBrush( RGB(255,0,0) );
CRect rect;
GetClientRect(&rect);
pDC->FillRect( &rect, &brush );
return CView::OnEraseBkgnd(pDC);
}
BOOL CTestView::OnEraseBkgnd(CDC* pDC) { CRect rect; CBrush brush; brush.CreateSolidBrush(GetDocument()->GetViewBkColor()); pDC->GetClipBox(rect); pDC->FillRect(rect,&brush); return true; }