Display Device Contexts

You create a display device context to draw in the client area of a display device. To do so, call the BeginPaint or GetDC function and supply a handle to a window. Windows CE will return a handle to a display device context with default objects, attributes, and graphic modes. You can begin drawing using these defaults, or you can choose a new object, change the attributes of an existing object, or choose a new mode. When you have finished drawing in the display area, you must release the device context by calling the EndPaint or ReleaseDC function. Use BeginPaint and EndPaint together, and use GetDC and ReleaseDC together. You use BeginPaint and EndPaint when you are processing WM_PAINT messages in your window procedure. The rest of the time, you generally use GetDC and ReleaseDC to obtain and release a DC.

Note Windows CE supports only common DCs.