OnInitDialog中:
// TODO: Add extra initialization here
CDC dc;
CBitmap *pBmp = NULL;
dc.CreateDC("DISPLAY", NULL, NULL, NULL);
pMemDC = new CDC;
if (!pMemDC)
return FALSE;
pMemDC->CreateCompatibleDC(&dc);
pBmp = new CBitmap;
if (!pBmp)
return FALSE;
pBmp->CreateCompatibleBitmap(&dc, 1024, 768);
pMemDC->SelectObject(pBmp);
ShowWindow(SW_HIDE);
pMemDC->BitBlt(0, 0, 1024, 768, &dc, 0, 0, SRCCOPY);
dc.DeleteDC();
pBmp->DeleteObject();
delete pBmp;
OnPaint中:
CPaintDC dc(this);
dc.BitBlt(0,0,1024, 768, pMemDC, 0, 0, SRCCOPY);
// TODO: Add extra initialization here
CDC dc;
CBitmap *pBmp = NULL;
dc.CreateDC("DISPLAY", NULL, NULL, NULL);
pMemDC = new CDC;
if (!pMemDC)
return FALSE;
pMemDC->CreateCompatibleDC(&dc);
pBmp = new CBitmap;
if (!pBmp)
return FALSE;
pBmp->CreateCompatibleBitmap(&dc, 1024, 768);
pMemDC->SelectObject(pBmp);
ShowWindow(SW_HIDE);
pMemDC->BitBlt(0, 0, 1024, 768, &dc, 0, 0, SRCCOPY);
dc.DeleteDC();
pBmp->DeleteObject();
delete pBmp;
OnPaint中:
CPaintDC dc(this);
dc.BitBlt(0,0,1024, 768, pMemDC, 0, 0, SRCCOPY);