在MSDN上说StretchBlt是内存拷贝,不过我调试程序时发现无论是StretchBlt还是BitBlt执行后内存都不好增加,下面的代码只有在LoadBitmap时内存才增加,void CjiemiantestDlg::InitMemDC()
{
CRect rect;
GetClientRect(&rect);
CDC *pdc=GetDC();
m_memDC.CreateCompatibleDC(pdc);
CBitmap memBitmap;
memBitmap.CreateCompatibleBitmap(pdc,rect.Width(),rect.Height());
m_memDC.SelectObject(&memBitmap);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BACKGROUND);
BITMAP bmpInfo;
bitmap.GetBitmap(&bmpInfo);
CDC tempDC;
tempDC.CreateCompatibleDC(&m_memDC);
tempDC.SelectObject(&bitmap);
m_memDC.StretchBlt(0,0,rect.Width(),rect.Height(),&tempDC,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,SRCCOPY);
bitmap.DeleteObject();
tempDC.DeleteDC();
}
{
CRect rect;
GetClientRect(&rect);
CDC *pdc=GetDC();
m_memDC.CreateCompatibleDC(pdc);
CBitmap memBitmap;
memBitmap.CreateCompatibleBitmap(pdc,rect.Width(),rect.Height());
m_memDC.SelectObject(&memBitmap);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BACKGROUND);
BITMAP bmpInfo;
bitmap.GetBitmap(&bmpInfo);
CDC tempDC;
tempDC.CreateCompatibleDC(&m_memDC);
tempDC.SelectObject(&bitmap);
m_memDC.StretchBlt(0,0,rect.Width(),rect.Height(),&tempDC,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,SRCCOPY);
bitmap.DeleteObject();
tempDC.DeleteDC();
}
解决方案 »
- vc怎么和ie交互啊
- 谁可以指点一下,如何把DATE 类型转换成CHAR[],谢谢了
- 为什么剪贴板只有一个字符?
- 关于注册算法的问题:我已经通过得到机器码MCode,作为用户的唯一标识码,我想通过RSA用公匙,私匙进行注册,请教算法例程。。。。。
- 急!在线等!关于通用控件的!那位大虾能帮忙!
- 一个cdc放bmp的问题,害我到现在没吃饭,谢谢大家帮忙
- CString 字符串 操作问题
- 请问widnows图像信息存放在什么地方,我想自己画图。
- 求个能正常运行获取CPUID、硬盘ID、MAC地址的源代码
- 如何在动画控件中通过资源标识符来播放AVI动画资源?
- vc 两个工程连接
- 急求一个RGB图像处理问题
是从静态内存中拷贝一份量到memroy