Share via


Working with Graphics Devices

Applications send output to a specified device by creating a device context (DC) for the device. The device context is a structure containing information about the device. Use a DC to store, retrieve, and modify the attributes of graphic objects and to specify graphic modes.

A DC also contains the attributes that determine how DirectDraw interacts with a device. These attributes eliminate the need to specify every piece of information Windows CE requires to display an object on a device. If you want to change an attribute, you can use attribute functions to change current device settings.

To create a DC, call a device context function, which then returns a device context handle that identifies the device. To create a memory DC, call the CreateCompatibleDC function. To create a DirectDraw surface DC, call the IDirectDrawSurface5::GetDC function. Once you have the DC, you can manipulate it with the SelectObject function and examine its current settings with the GetObject and GetCurrentObject functions.

The following table shows the DCs supported by Windows CE.

Device context Description
Memory Supports text and bitmap drawing operations. The DC is obtained by calling the CreateCompatibleDC function.
DirectDraw surface Supports text and bitmap operations on DirectDraw surfaces. The DC is obtained by calling the IDirectDrawSurface5::GetDC method.

The following table shows the modes that control text display, such as how colors are mixed on the screen.

Graphics mode Description
Background Defines how background colors are mixed with screen colors.
Foreground and background colors Defines how foreground and background colors are used for text output.

**Note   **Windows CE maps logical coordinates to physical coordinates in a 1:1 ratio from left to right and top to bottom.

See Also

Memory Device Contexts | Graphic Objects and Modes | Working with DirectDraw Surfaces

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.