Output (Device Context) Classes
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Output (Device Context) Classes.
These classes encapsulate the different types of device contexts available in Windows.
Most of the following classes encapsulate a handle to a Windows device context. A device context is a Windows object that contains information about the drawing attributes of a device such as a display or a printer. All drawing calls are made through a device-context object. Additional classes derived from CDC
encapsulate specialized device-context functionality, including support for Windows metafiles.
CDC
The base class for device contexts. Used directly for accessing the whole display and for accessing nondisplay contexts such as printers.
CPaintDC
A display context used in OnPaint
member functions of windows. Automatically calls BeginPaint
on construction and EndPaint
on destruction.
CClientDC
A display context for client areas of windows. Used, for example, to draw in an immediate response to mouse events.
CWindowDC
A display context for entire windows, including both the client and nonclient areas.
CMetaFileDC
A device context for Windows metafiles. A Windows metafile contains a sequence of graphics device interface (GDI) commands that can be replayed to create an image. Calls made to the member functions of a CMetaFileDC
are recorded in a metafile.
Related Classes
CPoint
Holds coordinate (x, y) pairs.
CSize
Holds distance, relative positions, or paired values.
CRect
Holds coordinates of rectangular areas.
CRgn
Encapsulates a GDI region for manipulating an elliptical, polygonal, or irregular area within a window. Used in conjunction with the clipping member functions in class CDC
.
CRectTracker
Displays and handles the user interface for resizing and moving rectangular objects.
CColorDialog
Provides a standard dialog box for selecting a color.
CFontDialog
Provides a standard dialog box for selecting a font.
CPrintDialog
Provides a standard dialog box for printing a file.