www.gusucode.com > VC++动画翻页效果的电话簿程序源码程序 > VC++动画翻页效果的电话簿程序源码程序/code/XMemDC.cpp

    //Download by http://www.NewXing.com
// 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;
}