|
The result of running the following code is red.
CDC dc;
CDC* pDrawDC = pDC;
CBitmap bitmap;
CBitmap* pOldBitmap;
To
CRect rect;
GetClientRect(&rect);
//============================================== ========
if (dc.CreateCompatibleDC(pDC))
{
if (bitmap.CreateCompatibleBitmap(pDC,
rect.Width(),
rect.Height()))
{
OnPrepareDC(&dc,NULL);
pDrawDC =&dc;
pOldBitmap = dc.SelectObject(&bitmap);
}
}
//============================================== ========
//pDoc->Draw(pDrawDC,ViewID);
>>>>>>>>>pDrawDC->FillSolidRect(0,0, 100,100, RGB(255,0,0));
pDrawDC->TextOut(1,1,_T("ABC"));
dc.DPtoLP(&rect);
//=============================================== ========
if (1)//pDrawDC != pDC)
{
pDC->BitBlt( 0, 0,rect.Width(), rect.Height(),
&dc, 0, 0, SRCCOPY);
dc.SelectObject(pOldBitmap);
bitmap.DeleteObject();
} |
|