CDC Member Functions

Construction
CDC Constructs a CDC object.
Initialization
CreateCompatibleDC Creates a memory-device context that is compatible with another device context. You can use it to prepare images in memory.
DeleteDC Deletes the Windows device context associated with this CDC object.
FromHandle Returns a pointer to a CDC object when given a handle to a device context. If a CDC object is not attached to the handle, a temporary CDC object is created and attached.
DeleteTempMap Called by the CWinApp idle-time handler to delete any temporary CDC object created by FromHandle. Also detaches the device context.
Attach Attaches a Windows device context to this CDC object.
Detach Detaches the Windows device context from this CDC object.
SetAttribDC Sets m_hAttribDC, the attribute device context.
SetOutputDC Sets m_hDC, the output device context.
ReleaseAttribDC Releases m_hAttribDC, the attribute device context.
ReleaseOutputDC Releases m_hDC, the output device context.
GetCurrentBitmap Returns a pointer to the currently selected CBitmap object.
GetCurrentBrush Returns a pointer to the currently selected CBrush object.
GetCurrentFont Returns a pointer to the currently selected CFont object.
GetCurrentPen Returns a pointer to the currently selected CPen object.
Device-Context Functions
GetSafeHdc Returns m_hDC, the output device context.
SaveDC Saves the current state of the device context.
RestoreDC Restores the device context to a previous state saved with SaveDC.
GetDeviceCaps Retrieves a specified kind of device-specific information about a given display device's capabilities.
Drawing-Tool Functions
GetBrushOrg Retrieves the origin of the current brush.
SetBrushOrg Specifies the origin for the next brush selected into a device context.
Type-Safe Selection Helpers
SelectObject Selects a GDI drawing object such as a pen.
SelectStockObject Selects one of the predefined stock pens, brushes, or fonts provided by Windows.
Color and Color Palette Functions
GetNearestColor Retrieves the closest logical color to a specified logical color that the given device can represent.
GetHalftoneBrush Retrieves a halftone brush.
Drawing-Attribute Functions
GetBkColor Retrieves the current background color.
SetBkColor Sets the current background color.
GetBkMode Retrieves the background mode.
SetBkMode Sets the background mode.
GetTextColor Retrieves the current text color.
SetTextColor Sets the text color.
Mapping Functions
GetMapMode Retrieves the current mapping mode.
GetViewportOrg In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetViewportExt In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetWindowOrg In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetWindowExt In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
Coordinate Functions
DPtoLP In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
LPtoDP In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
Clipping Functions
GetClipBox Retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary.
SelectClipRgn Combines the given region with the current clipping region by using the specified mode.
ExcludeClipRect Creates a new clipping region that consists of the existing clipping region minus the specified rectangle.
ExcludeUpdateRgn Prevents drawing within invalid areas of a window by excluding an updated region in the window from a clipping region.
IntersectClipRect Creates a new clipping region by forming the intersection of the current region and a rectangle.
OffsetClipRgn Moves the clipping region of the given device.
Line-Output Functions
GetCurrentPosition Retrieves the current position of the pen (in logical coordinates).
MoveTo Moves the current position.
LineTo Draws a line from the current position up to, but not including, a point.
Polyline Draws a set of line segments connecting the specified points.
PolyPolyline Draws multiple series of connected line segments. The current position is neither used nor updated by this function.
PolylineTo Draws one or more straight lines and moves the current position to the ending point of the last line.
Simple Drawing Functions
FillRect Fills a given rectangle by using a specific brush.
FrameRect Draws a border around a rectangle.
InvertRect Inverts the contents of a rectangle.
DrawIcon Draws an icon.
DrawDragRect Erases and redraws a rectangle as it is dragged.
FillSolidRect Fills a rectangle with a solid color.
Draw3dRect Draws a three-dimensional rectangle.
DrawEdge Draws the edges of a rectangle.
Ellipse and Polygon Functions
DrawFocusRect Draws a rectangle in the style used to indicate focus.
Ellipse Draws an ellipse.
Polygon Draws a polygon consisting of two or more points (vertices) connected by lines.
PolyPolygon Creates two or more polygons that are filled using the current polygon-filling mode. The polygons may be disjoint or they may overlap.
Polyline Draws a polygon consisting of a set of line segments connecting specified points.
Rectangle Draws a rectangle using the current pen and fills it using the current brush.
RoundRect Draws a rectangle with rounded corners using the current pen and filled using the current brush.
Bitmap Functions
PatBlt Creates a bit pattern.
BitBlt Copies a bitmap from a specified device context.
StretchBlt Moves a bitmap from a source rectangle and device into a destination rectangle, stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
GetPixel Retrieves the RGB color value of the pixel at the specified point.
SetPixel Sets the pixel at the specified point to the closest approximation of the specified color.
MaskBlt Combines the color data for the source and destination bitmaps using the given mask and raster operation.
Text Functions
ExtTextOut Writes a character string within a rectangular region using the currently selected font.
DrawText Draws formatted text in the specified rectangle.
GetTextExtent Computes the width and height of a line of text on the attribute device context using the current font to determine the dimensions.
GetOutputTextExtent Computes the width and height of a line of text on the output device context using the current font to determine the dimensions.
GetTextFace Copies the typeface name of the current font into a buffer as a null-terminated string.
GetTextMetrics Retrieves the metrics for the current font from the attribute device context.
GetOutputTextMetrics Retrieves the metrics for the current font from the output device context.
Scrolling Functions
ScrollDC Scrolls a rectangle of bits horizontally and vertically.

See Also

CDC Overview, CDC Data Members, Graphical Drawing Classes