Using the WM_PAINT Message

You can use the WM_PAINT message to carry out the drawing necessary for displaying information. Because Windows sends WM_PAINT messages to your application when your window must be updated or when you explicitly request an update, you can consolidate the code for drawing in your application's window procedure. You can then use this code whenever your application must draw either new or existing information.

The following sections show a variety of ways to use the WM_PAINT message to draw in a window.

·Drawing in the client area

·Redrawing the entire client area

·Redrawing in the update region

·Invalidating the client area

·Drawing a minimized window

·Drawing a custom window background