Partager via


CDC Members

Base Class Members

CObject Members

Color and Color Palette Functions

Font Functions

Construction/Destruction

Line-Output Functions

Coordinate Functions

Path Functions

Data Members

Clipping Functions

Device-Context Functions

Ellipse and Polygon Functions

Drawing-Attribute Functions

Printer Escape Functions

Drawing-Tool Functions

Bitmap Functions

Initialization

Simple Drawing Functions

Layout Functions

Metafile Functions

Mapping Functions

Scrolling Functions

Region Functions

Text Functions

Type-Safe Selection. Helpers

 

Data Members

CDC::m_hAttribDC

The attribute-device context used by this CDC object.

CDC::m_hDC

The output-device context used by this CDC object.

Construction

CDC::CDC

Constructs a CDC object.

Initialization

CDC::Attach

Attaches a Windows device context to this CDC object.

CDC::CreateCompatibleDC

Creates a memory-device context that is compatible with another device context. You can use it to prepare images in memory.

CDC::CreateDC

Creates a device context for a specific device.

CDC::CreateIC

Creates an information context for a specific device. This provides a fast way to get information about the device without creating a device context.

CDC::DeleteDC

Deletes the Windows device context associated with this CDC object.

CDC::DeleteTempMap

Called by the CWinApp idle-time handler to delete any temporary CDC object created by FromHandle. Also detaches the device context.

CDC::Detach

Detaches the Windows device context from this CDC object.

CDC::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.

CDC::GetCurrentBitmap

Returns a pointer to the currently selected CBitmap object.

CDC::GetCurrentBrush

Returns a pointer to the currently selected CBrush object.

CDC::GetCurrentFont

Returns a pointer to the currently selected CFont object.

CDC::GetCurrentPalette

Returns a pointer to the currently selected CPalette object.

CDC::GetCurrentPen

Returns a pointer to the currently selected CPen object.

CDC::GetGraphicsMode

Retrieves the current graphics mode for the specified device context.

CDC::GetWindow

Returns the window associated with the display device context.

CDC::ReleaseAttribDC

Releases m_hAttribDC, the attribute device context.

CDC::ReleaseOutputDC

Releases m_hDC, the output device context.

CDC::SetAttribDC

Sets m_hAttribDC, the attribute device context.

CDC::SetOutputDC

Sets m_hDC, the output device context.

CDC::SetGraphicsMode

Sets the current graphics mode for the specified device context.

Device-Context Functions

CDC::GetDeviceCaps

Retrieves a specified kind of device-specific information about a given display device's capabilities.

CDC::GetSafeHdc

Returns CDC::m_hDC, the output device context.

CDC::IsPrinting

Determines whether the device context is being used for printing.

CDC::ResetDC

Updates the m_hAttribDC device context.

CDC::RestoreDC

Restores the device context to a previous state saved with SaveDC.

CDC::SaveDC

Saves the current state of the device context.

Drawing-Tool Functions

CDC::EnumObjects

Enumerates the pens and brushes available in a device context.

CDC::GetBrushOrg

Retrieves the origin of the current brush.

CDC::SetBrushOrg

Specifies the origin for the next brush selected into a device context.

Type-Safe Selection Helpers

CDC::SelectObject

Selects a GDI drawing object such as a pen.

CDC::SelectStockObject

Selects one of the predefined stock pens, brushes, or fonts provided by Windows.

Color and Color Palette Functions

CDC::GetHalftoneBrush

Retrieves a halftone brush.

CDC::GetNearestColor

Retrieves the closest logical color to a specified logical color that the given device can represent.

CDC::RealizePalette

Maps palette entries in the current logical palette to the system palette.

CDC::SelectPalette

Selects the logical palette.

CDC::UpdateColors

Updates the client area of the device context by matching the current colors in the client area to the system palette on a pixel-by-pixel basis.

Drawing-Attribute Functions

CDC::GetBkColor

Retrieves the current background color.

CDC::GetBkMode

Retrieves the background mode.

CDC::GetColorAdjustment

Retrieves the color adjustment values for the device context.

CDC::GetDCBrushColor

Retrieves the current brush color.

CDC::GetDCPenColor

Retrieves the current pen color.

CDC::GetPolyFillMode

Retrieves the current polygon-filling mode.

CDC::GetROP2

Retrieves the current drawing mode.

CDC::GetStretchBltMode

Retrieves the current bitmap-stretching mode.

CDC::GetTextColor

Retrieves the current text color.

CDC::SetBkColor

Sets the current background color.

CDC::SetBkMode

Sets the background mode.

CDC::SetColorAdjustment

Sets the color adjustment values for the device context using the specified values.

CDC::SetDCBrushColor

Sets the current brush color.

CDC::SetDCPenColor

Sets the current pen color.

CDC::SetPolyFillMode

Sets the polygon-filling mode.

CDC::SetROP2

Sets the current drawing mode.

CDC::SetStretchBltMode

Sets the bitmap-stretching mode.

CDC::SetTextColor

Sets the text color.

Mapping Functions

CDC::GetMapMode

Retrieves the current mapping mode.

CDC::GetViewportExt

Retrieves the x- and y-extents of the viewport.

CDC::GetViewportOrg

Retrieves the x- and y-coordinates of the viewport origin.

CDC::GetWindowExt

Retrieves the x- and y-extents of the associated window.

CDC::GetWindowOrg

Retrieves the x- and y-coordinates of the origin of the associated window.

CDC::GetWorldTransform

Retrieves the current world-space to page-space transformation.

CDC::ModifyWorldTransform

Changes the world transformation for a device context using the specified mode.

CDC::OffsetViewportOrg

Modifies the viewport origin relative to the coordinates of the current viewport origin.

CDC::OffsetWindowOrg

Modifies the window origin relative to the coordinates of the current window origin.

CDC::ScaleViewportExt

Modifies the viewport extent relative to the current values.

CDC::ScaleWindowExt

Modifies the window extents relative to the current values.

CDC::SetMapMode

Sets the current mapping mode.

CDC::SetViewportExt

Sets the x- and y-extents of the viewport.

CDC::SetViewportOrg

Sets the viewport origin.

CDC::SetWindowExt

Sets the x- and y-extents of the associated window.

CDC::SetWindowOrg

Sets the window origin of the device context.

CDC::GetWorldTransform

Sets the current world-space to page-space transformation.

Layout Functions

CDC::GetLayout

Retrieves the layout of a device context (DC). The layout can be either left to right (default) or right to left (mirrored).

CDC::SetLayout

Changes the layout of a device context (DC).

Coordinate Functions

CDC::DPtoHIMETRIC

Converts device units into HIMETRIC units.

CDC::DPtoLP

Converts device units into logical units.

CDC::HIMETRICtoDP

Converts HIMETRIC units into device units.

CDC::HIMETRICtoLP

Converts HIMETRIC units into logical units.

CDC::LPtoDP

Converts logical units into device units.

CDC::LPtoHIMETRIC

Converts logical units into HIMETRIC units.

Region Functions

CDC::FillRgn

Fills a specific region with the specified brush.

CDC::FrameRgn

Draws a border around a specific region using a brush.

CDC::InvertRgn

Inverts the colors in a region.

CDC::PaintRgn

Fills a region with the selected brush.

Clipping Functions

CDC::ExcludeClipRect

Creates a new clipping region that consists of the existing clipping region minus the specified rectangle.

CDC::ExcludeUpdateRgn

Prevents drawing within invalid areas of a window by excluding an updated region in the window from a clipping region.

CDC::GetBoundsRect

Returns the current accumulated bounding rectangle for the specified device context.

CDC::GetClipBox

Retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary.

CDC::IntersectClipRect

Creates a new clipping region by forming the intersection of the current region and a rectangle.

CDC::OffsetClipRgn

Moves the clipping region of the given device.

CDC::PtVisible

Specifies whether the given point is within the clipping region.

CDC::RectVisible

Determines whether any part of the given rectangle lies within the clipping region.

CDC::SelectClipRgn

Combines the given region with the current clipping region by using the specified mode.

CDC::SetBoundsRect

Controls the accumulation of bounding-rectangle information for the specified device context.

Line-Output Functions

CDC::AngleArc

Draws a line segment and an arc, and moves the current position to the ending point of the arc.

CDC::Arc

Draws an elliptical arc.

CDC::ArcTo

Draws an elliptical arc. This function is similar to Arc, except that the current position is updated.

CDC::GetArcDirection

Returns the current arc direction for the device context.

CDC::GetCurrentPosition

Retrieves the current position of the pen (in logical coordinates).

CDC::LineTo

Draws a line from the current position up to, but not including, a point.

CDC::MoveTo

Moves the current position.

CDC::PolyBezier

Draws one or more Bzier splines. The current position is neither used nor updated.

CDC::PolyBezierTo

Draws one or more Bzier splines, and moves the current position to the ending point of the last Bzier spline.

CDC::PolyDraw

Draws a set of line segments and Bzier splines. This function updates the current position.

CDC::Polyline

Draws a set of line segments connecting the specified points.

CDC::PolylineTo

Draws one or more straight lines and moves the current position to the ending point of the last line.

CDC::PolyPolyline

Draws multiple series of connected line segments. The current position is neither used nor updated by this function.

CDC::SetArcDirection

Sets the drawing direction to be used for arc and rectangle functions.

Simple Drawing Functions

CDC::Draw3dRect

Draws a three-dimensional rectangle.

CDC::DrawDragRect

Erases and redraws a rectangle as it is dragged.

CDC::DrawEdge

Draws the edges of a rectangle.

CDC::DrawFrameControl

Draw a frame control.

CDC::DrawIcon

Draws an icon.

CDC::DrawState

Displays an image and applies a visual effect to indicate a state.

CDC::FillRect

Fills a given rectangle by using a specific brush.

CDC::FillSolidRect

Fills a rectangle with a solid color.

CDC::FrameRect

Draws a border around a rectangle.

CDC::InvertRect

Inverts the contents of a rectangle.

Ellipse and Polygon Functions

CDC::Chord

Draws a chord (a closed figure bounded by the intersection of an ellipse and a line segment).

CDC::DrawFocusRect

Draws a rectangle in the style used to indicate focus.

CDC::Ellipse

Draws an ellipse.

CDC::Pie

Draws a pie-shaped wedge.

CDC::Polygon

Draws a polygon consisting of two or more points (vertices) connected by lines.

CDC::Polyline

Draws a polygon consisting of a set of line segments connecting specified points.

CDC::PolyPolygon

Creates two or more polygons that are filled using the current polygon-filling mode. The polygons may be disjoint or they may overlap.

CDC::Rectangle

Draws a rectangle using the current pen and fills it using the current brush.

CDC::RoundRect

Draws a rectangle with rounded corners using the current pen and filled using the current brush.

Bitmap Functions

CDC::AlphaBlend

Displays bitmaps that have transparent or semitransparent pixels.

CDC::BitBlt

Copies a bitmap from a specified device context.

CDC::ExtFloodFill

Fills an area with the current brush. Provides more flexibility than the CDC::FloodFill member function.

CDC::FloodFill

Fills an area with the current brush.

CDC::GetPixel

Retrieves the RGB color value of the pixel at the specified point.

CDC::GradientFill

Fills rectangle and triangle structures with a gradating color.

CDC::MaskBlt

Combines the color data for the source and destination bitmaps using the given mask and raster operation.

CDC::PatBlt

Creates a bit pattern.

CDC::PlgBlt

Performs a bit-block transfer of the bits of color data from the specified rectangle in the source device context to the specified parallelogram in the given device context.

CDC::SetPixel

Sets the pixel at the specified point to the closest approximation of the specified color.

CDC::SetPixelV

Sets the pixel at the specified coordinates to the closest approximation of the specified color. SetPixelV is faster than SetPixel because it does not need to return the color value of the point actually painted.

CDC::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.

CDC::TransparentBlt

Transfers a bit-block of color data from the specified source device context into a destination device context, rendering a specified color transparent in the transfer.

Text Functions

CDC::DrawText

Draws formatted text in the specified rectangle.

CDC::DrawTextEx

Draws formatted text in the specified rectangle using additional formats.

CDC::ExtTextOut

Writes a character string within a rectangular region using the currently selected font.

CDC::GetCharABCWidthsI

Retrieves the widths, in logical units, of consecutive glyph indices in a specified range from the current TrueType font.

CDC::GetCharacterPlacement

Retrieves various types of information on a character string.

CDC::GetCharWidthI

Retrieves the widths, in logical coordinates, of consecutive glyph indices in a specified range from the current font.

CDC::GetOutputTabbedTextExtent

Computes the width and height of a character string on the output device context.

CDC::GetOutputTextExtent

Computes the width and height of a line of text on the output device context using the current font to determine the dimensions.

CDC::GetOutputTextMetrics

Retrieves the metrics for the current font from the output device context.

CDC::GetTabbedTextExtent

Computes the width and height of a character string on the attribute device context.

CDC::GetTextAlign

Retrieves the text-alignment flags.

CDC::GetTextCharacterExtra

Retrieves the current setting for the amount of intercharacter spacing.

CDC::GetTextExtent

Computes the width and height of a line of text on the attribute device context using the current font to determine the dimensions.

CDC::GetTextExtentExPointI

Retrieves the number of characters in a specified string that will fit within a specified space and fills an array with the text extent for each of those characters.

CDC::GetTextExtentPointI

Retrieves the width and height of the specified array of glyph indices.

CDC::GetTextFace

Copies the typeface name of the current font into a buffer as a null-terminated string.

CDC::GetTextMetrics

Retrieves the metrics for the current font from the attribute device context.

CDC::GrayString

Draws dimmed (grayed) text at the given location.

CDC::SetTextAlign

Sets the text-alignment flags.

CDC::SetTextCharacterExtra

Sets the amount of intercharacter spacing.

CDC::SetTextJustification

Adds space to the break characters in a string.

CDC::TabbedTextOut

Writes a character string at a specified location, expanding tabs to the values specified in an array of tab-stop positions.

CDC::TextOut

Writes a character string at a specified location using the currently selected font.

Font Functions

CDC::GetAspectRatioFilter

Retrieves the setting for the current aspect-ratio filter.

CDC::GetCharABCWidths

Retrieves the widths, in logical units, of consecutive characters in a given range from the current font.

CDC::GetCharWidth

Retrieves the fractional widths of consecutive characters in a given range from the current font.

CDC::GetFontData

Retrieves font metric information from a scalable font file. The information to retrieve is identified by specifying an offset into the font file and the length of the information to return.

CDC::GetFontLanguageInfo

Returns information about the currently selected font for the specified display context.

CDC::GetGlyphOutline

Retrieves the outline curve or bitmap for an outline character in the current font.

CDC::GetKerningPairs

Retrieves the character kerning pairs for the font that is currently selected in the specified device context.

CDC::GetOutlineTextMetrics

Retrieves font metric information for TrueType fonts.

CDC::GetOutputCharWidth

Retrieves the widths of individual characters in a consecutive group of characters from the current font using the output device context.

CDC::SetMapperFlags

Alters the algorithm that the font mapper uses when it maps logical fonts to physical fonts.

Printer Escape Functions

CDC::AbortDoc

Terminates the current print job, erasing everything the application has written to the device since the last call of the StartDoc member function.

CDC::DrawEscape

Accesses drawing capabilities of a video display that are not directly available through the graphics device interface (GDI).

CDC::EndDoc

Ends a print job started by the StartDoc member function.

CDC::EndPage

Informs the device driver that a page is ending.

CDC::Escape

Allows applications to access facilities that are not directly available from a particular device through GDI. Also allows access to Windows escape functions. Escape calls made by an application are translated and sent to the device driver.

CDC::QueryAbort

Calls the AbortProc callback function for a printing application and queries whether the printing should be terminated.

CDC::SetAbortProc

Sets a programmer-supplied callback function that Windows calls if a print job must be aborted.

CDC::StartDoc

Informs the device driver that a new print job is starting.

CDC::StartPage

Informs the device driver that a new page is starting.

Scrolling Functions

CDC::ScrollDC

Scrolls a rectangle of bits horizontally and vertically.

Metafile Functions

CDC::AddMetaFileComment

Copies the comment from a buffer into a specified enhanced-format metafile.

CDC::PlayMetaFile

Plays the contents of the specified metafile on the given device. The enhanced version of PlayMetaFile displays the picture stored in the given enhanced-format metafile. The metafile can be played any number of times.

Path Functions

CDC::AbortPath

Closes and discards any paths in the device context.

CDC::BeginPath

Opens a path bracket in the device context.

CDC::CloseFigure

Closes an open figure in a path.

CDC::EndPath

Closes a path bracket and selects the path defined by the bracket into the device context.

CDC::FillPath

Closes any open figures in the current path and fills the path's interior by using the current brush and polygon-filling mode.

CDC::FlattenPath

Transforms any curves in the path selected into the current device context, and turns each curve into a sequence of lines.

CDC::GetMiterLimit

Returns the miter limit for the device context.

CDC::GetPath

Retrieves the coordinates defining the endpoints of lines and the control points of curves found in the path that is selected into the device context.

CDC::SelectClipPath

Selects the current path as a clipping region for the device context, combining the new region with any existing clipping region by using the specified mode.

CDC::SetMiterLimit

Sets the limit for the length of miter joins for the device context.

CDC::StrokeAndFillPath

Closes any open figures in a path, strikes the outline of the path by using the current pen, and fills its interior by using the current brush.

CDC::StrokePath

Renders the specified path by using the current pen.

CDC::WidenPath

Redefines the current path as the area that would be painted if the path were stroked using the pen currently selected into the device context.

Operators

CDC::operator HDC

Retrieves the handle of the device context.

See Also

Concepts

CDC Class

Hierarchy Chart