~cpp
#pragma once
class CmyDouBuffDC
{
private:
CRect m_rt;
CDC* m_pDC;
CDC* m_pMemDC;
CBitmap m_bmp;
public:
CmyDouBuffDC(CDC *pDC, CRect rt){
m_rt = rt;
m_pDC = pDC;
m_pMemDC = new CDC();
m_pMemDC->CreateCompatibleDC(m_pDC);
m_bmp.CreateCompatibleBitmap(m_pDC, m_rt.Width(), m_rt.Height());
m_pMemDC->SelectObject(&m_bmp);
m_pMemDC->Rectangle(0, 0, m_rt.Width(), m_rt.Height());
}
~CmyDouBuffDC(void){
m_pDC->BitBlt(0, 0, m_rt.Width(), m_rt.Height(), m_pMemDC, 0, 0, SRCCOPY);
m_pMemDC->DeleteDC();
m_bmp.DeleteObject();
}
CDC* getMemDC(){return m_pMemDC;}
};