The window background is the color or pattern the client area is filled with before a window begins painting in the client area. Windows paints the background for a window or gives the window the opportunity to do so by sending a WM_ERASEBKGND message to the window when the application calls the BeginPaint function.
The background is important because if it is not erased, the client area will con-tain whatever was originally on the screen before the window was moved there. Windows erases the background by filling it with the background brush specified by the window's class.
Windows applications that use class or private display contexts should be careful about erasing the background. Windows assumes the background is to be computed by using the MM_TEXT mapping mode. If the display context has any other mapping mode, the area erased may not be within the visible part of the client area.