Void cstatisticsdlg :: onpaint () {CPAINTDC DC (this); // device context for Painting // Todo: Add message handler code // Not for the drawing message CDIALOG :: onpaint () // masaka: Learn to show the background bitmap // load CBitmap bmpBk; bmpBk.LoadBitmap (IDB_BITMAP_TEST); // get info BITMAP bmpInfo; bmpBk.GetBitmap (& bmpInfo); CRect wndRect; this-> GetClientRect (& wndRect);
// Create CDC in Memory CDC DCMemory; DcMemory.createCompatibleDC (& DC);
// select in the bitmap cbitmap * PoldbitMap = DcMemory.selectObject (& bmpbk); // show it! //dc.bitblt(0, 0, wndrect.width (), WndRect.Height (), & DCMemory, 0, 0, SRCCOPY); dc.StretchBlt (0, 0, wndRect.Width (), wndRect.Height (), & dcMemory, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, SRCCOPY); // restore dcMemory.SelectObject (pOldBitmap);
}