|
I made a drawing program, using memory DC, the original code is as follows: (in the OnDraw (CDC * pDC) function of C * View) ----- but after running, the entire View area is black?
CDC dc;
CDC * pDrawDC = pDC;
CBitmap bitmap;
CBitmap * pOldBitmap;
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-> TextOut (1,1, * str);
dc.DPtoLP (&rect);
// ==================================================== =========
if (pDrawDC! = pDC)
{
pDC-> BitBlt (0, 0, rect.Width (), rect.Height (),
&dc, 0, 0, SRCCOPY);
dc.SelectObject (pOldBitmap);
bitmap.DeleteObject ();
}
Please help me, what is the problem? |
|