|
Every time it runs, the memory will increase by 12 to 16 bytes. What's wrong?
Code:
void CShadowCtrl :: DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC * dc = GetDC ();
dcMemory.CreateCompatibleDC (dc);
CRect rc;
GetClientRect (&rc);
CBitmap bmp;
bmp.CreateCompatibleBitmap (dc, rc.Width (), rc.Height ());
dcMemory.SelectObject (&bmp);
Ranch
CBrush brush, * oldBrush;
CPen pen, * oldPen;
// draw BK
brush.Detach ();
brush.CreateSolidBrush (m_bkColor);
pen.Detach ();
pen.CreatePen (PS_SOLID, 1, m_bkColor);
oldBrush = dcMemory.SelectObject (&brush);
oldPen = dcMemory.SelectObject (&pen);
dcMemory.Rectangle (&rc);
// Draw Text
dcMemory.SelectObject (&m_textFont);
CString strText;
GetWindowText (strText);
dcMemory.SetTextColor (m_textCurrColor);
dcMemory.SetBkMode (TRANSPARENT);
dcMemory.DrawText (strText,&rc, DT_CENTER | DT_VCENTER | DT_WORDBREAK);
dc-> BitBlt (0,0, rc.Width (), rc.Height (),&dcMemory, 0,0, SRCCOPY);
dcMemory.SelectObject (oldBrush);
dcMemory.SelectObject (oldPen);
brush.DeleteObject ();
pen.DeleteObject ();
bmp.DeleteTempMap ();
bmp.DeleteObject ();
dcMemory.DeleteDC ();
} |
|