![]() |
#2
玩出来的代码2013-01-11 13:04
|
void CGAME_1View::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect parentsRect;
CBrush brush(RGB(255,0,0));
this->GetClientRect(&parentsRect);
dc.FillRect(&parentsRect,&brush);
// Do not call CView::OnPaint() for painting messages
}
上面这段代码能运行,但是没有背景填充红色的效果。这是为什么啊?我百度了下,有的说是在OnEraseBkgnd函数中改变背景色。但是我在OnEraseBkgnd中写了代码还是不OK