1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
HDC hdc;
HDC hdcmem;
HBRUSH hBrush = CreateSolidBrush(RGB(255,0,0));
HBRUSH hOldBrush;
HBITMAP hbmBackBuffer;
HBITMAP hbmOldBitmap;
PAINTSTRUCT ps;
hdc = BeginPaint(hWnd,&ps);
// Create BackBuffer Stuff
hdcmem = CreateCompatibleDC(hdc);
hbmBackBuffer = CreateCompatibleBitmap(hdc, 160, 288);
hbmOldBitmap = (HBITMAP)SelectObject(hdcmem,hbmBackBuffer);
hOldBrush = (HBRUSH)SelectObject(hdcmem,hBrush);
// Draw on Back Buffer
Rectangle(hdcmem,0,0,64,64);
// Draw on Screen
BitBlt(hdc,0,0,160,288,hdcmem,0,0,SRCCOPY);
// Delete Stuff
DeleteObject(SelectObject(hdcmem,hbmOldBitmap));
DeleteObject(SelectObject(hdcmem,hOldBrush));
DeleteDC(hdcmem);
// End Painting
EndPaint(hWnd,&ps);
|