The pen, brush, bitmap, palette, region, and path associated with a device context are referred to as the device context's graphic objects. Following are the attributes associated with each of these objects.
Graphic Object | Associated Attributes |
---|---|
Bitmap | Size, in bytes; dimensions, in pixels; color-format; compression scheme; and so on |
Brush | Style, color, pattern, and origin |
Palette | Colors and size (or number of colors) |
Font | Typeface name, width, height, weight, character set, and so on |
Path | Shape |
Pen | Style, width, and color |
Region | Location and dimensions |
When an application creates a device context, the system automatically stores a set of default objects in it. (There is no default bitmap or path.) An application can examine the attributes of the default objects by calling the GetCurrentObject and GetObject functions. The application can change these defaults by creating a new object and selecting it into the device context. An object is selected into a device context by calling the SelectObject function.
An application can set the current brush color to a specified color value with SetDCBrushColor .
The GetDCBrushColor function returns the DC brush color. The SetDCPenColor function sets the pen color to a specified color value. The GetDCPenColor function returns the DC pen color.