扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:刘 涛 来源:yesky 2007年11月16日
关键字: Visual C++ 主框架窗口 添加 位图
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(); } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。