Hi all

My program currently loads a bitmap (given a filename) and draws it to a window (win32 application).

The problem is that once a different bitmap is loaded and drawn to the window... if the new bitmap is smaller than the old bitmap, the edges of the old bitmap are still visible once the new bitmap is drawn.
I need a way to completely clear the window before drawing each new bitmap. ... How do I do this??


Here is where I paint the window...

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                
    {
      case WM_PAINT:
        {
              HDC hDC = GetDC(hwnd);
              if (cd->GetFilename() != NULL) cd ->DrawBits(hDC,0,0);
              ReleaseDC(hwnd, hDC);
              break;
         }
        //handle other messages
       }
}

... where cd is the CDib*. (my bitmap class)

Each time the user loads a new bitmap to display, I call cd->LoadBitmapFile(filename).

erase the window -- get current window RECT object then call FillRect() with the desired color.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.