XMemDC.cpp
上传用户:cuijiu615
上传日期:2007-03-28
资源大小:45k
文件大小:1k
- // XMemDC.cpp: implementation of the XMemDC class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "XMemDC.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- XMemDC::XMemDC(CDC* pDC,const CRect& rcBounds):CDC()
- {
- CreateCompatibleDC(pDC);
- m_bitmap=new CBitmap;
- m_bitmap->CreateCompatibleBitmap(pDC,rcBounds.Width(),rcBounds.Height());
- m_oldBitmap=SelectObject(m_bitmap);
- m_pDC=pDC;
- m_rcBounds=rcBounds;
- }
- XMemDC::~XMemDC()
- {
- m_pDC->BitBlt(m_rcBounds.left,m_rcBounds.top,m_rcBounds.Width(),m_rcBounds.Height(),this,m_rcBounds.left,m_rcBounds.top,SRCCOPY);
- SelectObject(m_oldBitmap);
- if(m_bitmap!=NULL)
- delete m_bitmap;
- }