MFC中CBitmap的简单复制方法 (Copy CBitmap)
2012-03-25 15:30
405 查看
http://wupei.j2megame.org/archives/86
在这里为大家提供一种CBitmap复制的方法
经过自己的一层封装,就形成的非常好用的CBitmap的复制工具函数
先看函数实现:
在这里为大家提供一种CBitmap复制的方法
经过自己的一层封装,就形成的非常好用的CBitmap的复制工具函数
先看函数实现:
HBITMAP CMyDialog::CopyBitmap(HBITMAP hSourceHbitmap) { CDC sourceDC; CDC destDC; sourceDC.CreateCompatibleDC(NULL); destDC.CreateCompatibleDC(NULL); //The bitmap information. BITMAP bm = {0}; //Get the bitmap information. ::GetObject(hSourceHbitmap, sizeof(bm), &bm); // Create a bitmap to hold the result HBITMAP hbmResult = ::CreateCompatibleBitmap(CClientDC(NULL), bm.bmWidth, bm.bmHeight); HBITMAP hbmOldSource = (HBITMAP)::SelectObject(sourceDC.m_hDC, hSourceHbitmap); HBITMAP hbmOldDest = (HBITMAP)::SelectObject(destDC.m_hDC, hbmResult); destDC.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &sourceDC, 0, 0, SRCCOPY ); // Restore DCs ::SelectObject(sourceDC.m_hDC, hbmOldSource); ::SelectObject(destDC.m_hDC, hbmOldDest); ::DeleteObject(sourceDC.m_hDC); ::DeleteObject(destDC.m_hDC); return hbmResult; }
相关文章推荐
- MFC中CBitmap的简单复制方法 (Copy CBitmap)
- MFC中CBitmap的简单复制方法 (Copy CBitmap)
- MFC中CImage的简单复制方法 (Copy CImage)
- MFC中CImage的简单复制方法 (Copy CImage)
- Python中的复制操作及copy模块中的浅拷贝与深拷贝方法
- 回调函数中使用MFC类的成员或对话框控件的简单方法。
- php不使用copy()函数复制文件的方法
- (复制对象属性方法)beanutils.copyproperties
- 2017/12/31Java基础学习——复制数组の——Arrays.copyOfRange()方法讲解
- MFC判断内存泄露的简单方法 CmemoryState
- 浅析mfc的Cstring类的copy-on-write(写时复制)功能
- Javascript 实现复制(Copy)动作方法大全
- 2017/12/30Java基础学习——复制数组のSystem.arraycopy()方法讲解
- 简单讲解MySQL的数据库复制方法
- Python中的复制操作及copy模块中的浅拷贝与深拷贝方法
- 回调函数中使用MFC类的成员或对话框控件的简单方法
- 不用splitter控件 简单实现对mfc对话框的分割的方法
- 百度文库复制最简单方法
- 在MFC中显示Jpg格式图片的简单实现方法
- VC/MFC简单实用的全屏方法