VC 建立多文档工程,CMainFrame主框架设置了背景色,但是当打开一个新文档非最大化状态时,鼠标点住拖动 主框架的背景色不能时时刷新,请问这个问题怎么解决? 很急很急,十万火急
下面贴出代码:
1./*截获MDI客户窗口WM_PAINT消息,在这个函数中向主框架窗口发送WM_PAINT/消息,
在该消息的处理函数中实现彩色位图的显示或者设置背景色*/
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if ( pMsg->hwnd == m_hWndMDIClient && pMsg->message == WM_PAINT )
{
Invalidate() ;
}
return CMDIFrameWnd::PreTranslateMessage(pMsg);
}
2./*设置主框架背景色或者贴上一张位图*/
void CMainFrame::OnPaint()
{
// CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CDC dc;
dc.m_hDC = ::GetDC( this->m_hWndMDIClient );
dc.SetBkMode( TRANSPARENT );
CRect clientRect;
GetClientRect( &clientRect );
dc.FillSolidRect( &clientRect, RGB(100,100,2