| 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) PostMessage(WM_PAINT); return CMDIFrameWnd::PreTranslateMessage(pMsg); } void CMainFrame::OnPaint() { CDC dc, memdc; dc.m_hDC=::GetDC(this->m_hWndMDIClient); CRect rect; CBitmap bitmap; BITMAP szbitmap; bitmap.LoadBitmap(IDB_BITMAP1); bitmap.GetObject(sizeof(BITMAP),&szbitmap); CSize size(szbitmap.bmWidth,szbitmap.bmHeight); memdc.CreateCompatibleDC(&dc); CBitmap *oldbitmap=memdc.SelectObject(&bitmap); GetClientRect(&rect); StretchBlt(dc.m_hDC,0,0,rect.Width(),rect.Height(), memdc.m_hDC,0,0,size.cx,size.cy,SRCCOPY); memdc.SelectObject(oldbitmap); memdc.DeleteDC(); dc.DeleteDC(); CMDIFrameWnd::OnPaint(); } |
用户评论