GDI BITMAP issue

I create a double buffer with a bitmap. And no more flickering yay!!!
But I get a black background and now I can't figure out how to change it back to grey

case WM_PAINT:
{
RECT bufferRect;
::GetClientRect(hWnd, &bufferRect);
int buffer_x = bufferRect.right - bufferRect.left;
int buffer_y = bufferRect.bottom - bufferRect.top;
hdc = ::BeginPaint(hWnd, &ps);
hdcBuffer = ::CreateCompatibleDC(hdc);
buffer = ::CreateCompatibleBitmap(hdc, buffer_x, buffer_y);
::SelectObject(hdcBuffer, buffer);
::Rectangle(hdcBuffer, 50, 50, 200, 100);
::BitBlt(hdc, 0, 0, buffer_x, buffer_y, hdcBuffer, 0, 0, SRCCOPY);
::DeleteDC(hdcBuffer);
::DeleteObject(buffer);
::ReleaseDC(hWnd, hdc);
::EndPaint(hWnd, &ps);
}
break;
[838 byte] By [Kiryn] at [2007-11-20 10:35:18]
# 1 Re: GDI BITMAP issue
The bitmap will be initialized to all black, so naturally the background of the blitted image would be black.

Simply initialize the painting cycle with an 'erase' of the background, by drawing a gray (or whatever background color you want) rectangle with a null border pen before you begin painting.
JVene at 2007-11-9 13:32:06 >