void CMy08301Dlg::OnPaint()
{
CPaintDC dc(this);
CDC dcMem;
CBitmap bmpMem;
dcMem.CreateCompatibleDC(&dc);
bmpMem.CreateCompatibleBitmap(&dc,800,480);
dcMem.SelectObject(&bmpMem);
CDC dcMem2;
dcMem2.CreateCompatibleDC(&dcMem);
CBitmap bmpMem2;
CString ok=L"//……//ok.bmp/0";
CString cancel=L"//……//cancel.bmp/0";
bmpMem2.m_hObject=SHLoadDIBitmap(ok);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(700,350,82,36,&dcMem2,0,0,SRCCOPY); //加载位图ok
//---------------------------------------------------------------------------------------
bmpMem2.m_hObject=SHLoadDIBitmap(cancel);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(707,8,70,45,&dcMem2,0,0,SRCCOPY); //加载位图cancel
//重复上面三句代码 加载多幅位图
//--------------------------------------------------------------------------------------
dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);
bmpMem2.DeleteObject();
dcMem2.DeleteDC();
bmpMem.DeleteObject();
dcMem.DeleteDC();
}
备注:windows桌面系统下:
1.没有SHLoadDIBitmap
2.貌似也不能重复用dcMem2,我定义了多个兼容DC将位图加载到dcMem中。
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ezhong的博客签名-------------------------------------
以上内容来自ezhong的博客园,作者:ezhong
ezhong的博客园: http://www.cnblogs.com/ezhong
感谢您的阅读。感谢您的分享。