在使用过程中大家可能会出现 在类向导中添加消息隐射找不到
Ctrl+W
也可以手动添加
注意:
1、OnEraseBkgnd函数中返回TRUE或FALSE有什么区别?
WM_ERASEBKGND
Return Values
An application should return nonzero if it erases the background; otherwise, it should return zero.
true表示已处理背景刷新,false表示需要在OnPaint里处理
2、在OnEraseBkgnd中绘制对话框的背景图片和在OnPaint中绘制对话框的背景图片由什么区别,另外OnEraseBkgnd和CtlColor有什么区别?
OnEraseBkgnd是在窗口大小发生改变等情况下发生的,它将绘制窗口背景;
OnCtlColor是当窗口的控件需要绘制时发生的,它将绘制窗口的控件。
OnEraseBkgnd :在窗口背景需要重绘时调用.
OnPaint : 此时OnEraseBkgnd已经调用过了,所以在此响应函数体内对背景进行的操作将覆盖OnEraseBkgnd中所做的操作.
OnCtlColor : 有于在窗口将要被(第一次)绘制时响应,子窗口可以通过发关WM_CTLCOLOR请求父窗口传来一个HBRUSH.
使用:默认情况下的原型
BOOL CXXXX::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return CDialog::OnEraseBkgnd(pDC);
}
在双缓存处理界面的时候,返回 return true;