# Graphics Class

The **Graphics** class provides methods for drawing lines, curves, figures, images, and text. A Graphics object stores attributes of the display device and attributes of the items to be drawn.

## Methods

The **Graphics** class has these methods.

Method | Description |
---|---|

Graphics::AddMetafileComment | The Graphics::AddMetafileComment method adds a text comment to an existing metafile. |

Graphics::BeginContainer | The Graphics::BeginContainer method begins a new graphics container. |

Graphics::BeginContainer | |

Graphics::Clear | The Graphics::Clear method clears a Graphicsobject to a specified color. |

Graphics::DrawArc | The Graphics::DrawArc method draws an arc. The arc is part of an ellipse. |

Graphics::DrawArc | The Graphics::DrawArc method draws an arc. The arc is part of an ellipse. |

Graphics::DrawArc | The Graphics::DrawArc method draws an arc. The arc is part of an ellipse. |

Graphics::DrawBezier | The Graphics::DrawBezier method draws a Bézier spline. |

Graphics::DrawBezier | The Graphics::DrawBezier method draws a Bézier spline. |

Graphics::DrawBezier | The Graphics::DrawBezier method draws a Bézier spline. |

Graphics::DrawBeziers | The Graphics::DrawBeziers method draws a sequence of connected Bézier splines. |

Graphics::DrawCachedBitmap | The Graphics::DrawCachedBitmap method draws the image stored in a CachedBitmap object. |

Graphics::DrawClosedCurve | The Graphics::DrawClosedCurve method draws a closed cardinal spline. |

Graphics::DrawClosedCurve | The Graphics::DrawClosedCurve method draws a closed cardinal spline. |

Graphics::DrawClosedCurve | The Graphics::DrawClosedCurve method draws a closed cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawDriverString | The Graphics::DrawDriverString method draws characters at the specified positions. The method gives the client complete control over the appearance of text. The method assumes that the client has already set up the format and layout to be applied. |

Graphics::DrawEllipse | The Graphics::DrawEllipse method draws an ellipse. |

Graphics::DrawEllipse | The Graphics::DrawEllipse method draws an ellipse. |

Graphics::DrawEllipse | The Graphics::DrawEllipse method draws an ellipse. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image at a specified location. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image at a specified location. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawImage | The Graphics::DrawImage method draws a specified portion of an image at a specified location. |

Graphics::DrawImage | The method draws a portion of an image after applying a specified effect. |

Graphics::DrawLine | The Graphics::DrawLine method draws a line that connects two points. |

Graphics::DrawLine | The Graphics::DrawLine method draws a line that connects two points. |

Graphics::DrawLine | The Graphics::DrawLine method draws a line that connects two points. |

Graphics::DrawLines | The Graphics::DrawLines method draws a sequence of connected lines. |

Graphics::DrawPath | The Graphics::DrawPath method draws a sequence of lines and curves defined by a GraphicsPath object. |

Graphics::DrawPie | The Graphics::DrawPie method draws a pie. |

Graphics::DrawPie | The Graphics::DrawPie method draws a pie. |

Graphics::DrawPie | The Graphics::DrawPie method draws a pie. |

Graphics::DrawPolygon | The Graphics::DrawPolygon method draws a polygon. |

Graphics::DrawRectangle | The Graphics::DrawRectangle method draws a rectangle. |

Graphics::DrawRectangle | The Graphics::DrawRectangle method draws a rectangle. |

Graphics::DrawRectangle | The Graphics::DrawRectangle method draws a rectangle. |

Graphics::DrawRectangles | The Graphics::DrawRectangles method draws a sequence of rectangles. |

Graphics::DrawString | The Graphics::DrawString method draws a string based on a font and an origin for the string. |

Graphics::DrawString | The Graphics::DrawString method draws a string based on a font, a string origin, and a format. |

Graphics::EndContainer | The Graphics::EndContainer method closes a graphics container that was previously opened by the Graphics::BeginContainer method. |

Graphics::EnumerateMetafile | The Graphics::EnumerateMetafile method calls an application-defined callback function for each record in a specified metafile. You can use this method to display a metafile by calling PlayRecord in the callback function. |

Graphics::EnumerateMetafile | The Graphics::EnumerateMetafile method calls an application-defined callback function for each record in a specified metafile. You can use this method to display a metafile by calling PlayRecord in the callback function. |

Graphics::EnumerateMetafile | The Graphics::EnumerateMetafile method calls an application-defined callback function for each record in a specified metafile. You can use this method to display a metafile by calling PlayRecord in the callback function. |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::EnumerateMetafile | |

Graphics::ExcludeClip | The Graphics::ExcludeClip method updates the clipping region to the portion of itself that does not intersect the specified rectangle. |

Graphics::ExcludeClip | The Graphics::ExcludeClip method updates the clipping region with the portion of itself that does not overlap the specified region. |

Graphics::FillClosedCurve | The Graphics::FillClosedCurve method creates a closed cardinal spline from an array of points and uses a brush to fill, according to a specified mode, the interior of the spline. |

Graphics::FillClosedCurve | The Graphics::FillClosedCurve method creates a closed cardinal spline from an array of points and uses a brush to fill the interior of the spline. |

Graphics::FillClosedCurve | The Graphics::FillClosedCurve method creates a closed cardinal spline from an array of points and uses a brush to fill, according to a specified mode, the interior of the spline. |

Graphics::FillEllipse | The Graphics::FillEllipse method uses a brush to fill the interior of an ellipse that is specified by coordinates and dimensions. |

Graphics::FillEllipse | The Graphics::FillEllipse method uses a brush to fill the interior of an ellipse that is specified by a rectangle. |

Graphics::FillEllipse | The Graphics::FillEllipse method uses a brush to fill the interior of an ellipse that is specified by coordinates and dimensions. |

Graphics::FillPath | The Graphics::FillPath method uses a brush to fill the interior of a path. If a figure in the path is not closed, this method treats the nonclosed figure as if it were closed by a straight line that connects the figure's starting and ending points. |

Graphics::FillPie | The Graphics::FillPie method uses a brush to fill the interior of a pie. |

Graphics::FillPie | The Graphics::FillPie method uses a brush to fill the interior of a pie. |

Graphics::FillPie | The Graphics::FillPie method uses a brush to fill the interior of a pie. |

Graphics::FillPolygon | The Graphics::FillPolygon method uses a brush to fill the interior of a polygon. |

Graphics::FillPolygon | The Graphics::FillPolygon method uses a brush to fill the interior of a polygon. |

Graphics::FillPolygon | The Graphics::FillPolygon method uses a brush to fill the interior of a polygon. |

Graphics::FillRectangle | The Graphics::FillRectangle method uses a brush to fill the interior of a rectangle. |

Graphics::FillRectangle | The Graphics::FillRectangle method uses a brush to fill the interior of a rectangle. |

Graphics::FillRectangle | The Graphics::FillRectangle method uses a brush to fill the interior of a rectangle. |

Graphics::FillRectangles | The Graphics::FillRectangles method uses a brush to fill the interior of a sequence of rectangles. |

Graphics::FillRegion | The Graphics::FillRegion method uses a brush to fill a specified region. |

Graphics::Flush | The Graphics::Flush method flushes all pending graphics operations. |

Graphics::FromHDC | The Graphics::FromHDC method creates a Graphics object that is associated with a specified device context. |

Graphics::FromHDC | The Graphics::FromHDC method creates a Graphics object that is associated with a specified device context and a specified device. |

Graphics::FromHWND | The Graphics::FromHWND method creates a Graphicsobject that is associated with a specified window. |

Graphics::FromImage | The Graphics::FromImage method creates a Graphicsobject that is associated with a specified Image object. |

Graphics::GetClip | The Graphics::GetClip method gets the clipping region of this Graphics object. |

Graphics::GetClipBounds | The Graphics::GetClipBounds method gets a rectangle that encloses the clipping region of this Graphics object. |

Graphics::GetCompositingMode | The Graphics::GetCompositingMode method gets the compositing mode currently set for this Graphics object. |

Graphics::GetCompositingQuality | The Graphics::GetCompositingQuality method gets the compositing quality currently set for this Graphics object. |

Graphics::GetDpiX | The Graphics::GetDpiX method gets the horizontal resolution, in dots per inch, of the display device associated with this Graphics object. |

Graphics::GetDpiY | The Graphics::GetDpiY method gets the vertical resolution, in dots per inch, of the display device associated with this Graphics object. |

Graphics::GetHalftonePalette | The Graphics::GetHalftonePalette method gets a Windows halftone palette. |

Graphics::GetHDC | The Graphics::GetHDC method gets a handle to the device context associated with this Graphics object. |

Graphics::GetInterpolationMode | The Graphics::GetInterpolationMode method gets the interpolation mode currently set for this Graphics object. The interpolation mode determines the algorithm that is used when images are scaled or rotated. |

Graphics::GetLastStatus | The Graphics::GetLastStatus method returns a value that indicates the nature of this Graphics object's most recent method failure. |

Graphics::GetNearestColor | The Graphics::GetNearestColor method gets the nearest color to the color that is passed in. This method works on 8-bits per pixel or lower display devices for which there is an 8-bit color palette. |

Graphics::GetPageScale | The Graphics::GetPageScale method gets the scaling factor currently set for the page transformation of this Graphics object. The page transformation converts page coordinates to device coordinates. |

Graphics::GetPageUnit | The Graphics::GetPageUnit method gets the unit of measure currently set for this Graphics object. |

Graphics::GetPixelOffsetMode | The Graphics::GetPixelOffsetMode method gets the pixel offset mode currently set for this Graphics object. |

Graphics::GetRenderingOrigin | The Graphics::GetRenderingOrigin method gets the rendering origin currently set for this Graphics object. |

Graphics::GetSmoothingMode | The Graphics::GetSmoothingMode method determines whether smoothing (antialiasing) is applied to the Graphics object. |

Graphics::GetTextContrast | The Graphics::GetTextContrast method gets the contrast value currently set for this Graphics object. The contrast value is used for antialiasing text. |

Graphics::GetTextRenderingHint | The Graphics::GetTextRenderingHint method returns the text rendering mode currently set for this Graphics object. |

Graphics::GetTransform | The Graphics::GetTransform method gets the world transformation matrix of this Graphics object. |

Graphics::GetVisibleClipBounds | The Graphics::GetVisibleClipBounds method gets a rectangle that encloses the visible clipping region of this Graphics object. |

Graphics::Graphics | Creates a Graphics::Graphics object that is associated with a specified device context and a specified device. |

Graphics::Graphics | Creates a Graphics::Graphics object that is associated with a specified window. |

Graphics::Graphics | Creates a Graphics::Graphics object that is associated with an Image object. |

Graphics::Graphics | This topic lists the constructors of the Graphics class. For a complete class listing, see Graphics Class. |

Graphics::Graphics | This topic lists the constructors of the Graphics class. For a complete class listing, see Graphics Class. |

Graphics::IntersectClip | The Graphics::IntersectClip method updates the clipping region of this Graphics object to the portion of the specified rectangle that intersects with the current clipping region of this Graphics object. |

Graphics::IntersectClip | The Graphics::IntersectClip method updates the clipping region of this Graphics object to the portion of the specified region that intersects with the current clipping region of this Graphics object. |

Graphics::IsClipEmpty | The Graphics::IsClipEmpty method determines whether the clipping region of this Graphics object is empty. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified point is inside the visible clipping region of this Graphics object. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified rectangle intersects the visible clipping region of this Graphics object. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified rectangle intersects the visible clipping region of this Graphics object. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified point is inside the visible clipping region of this Graphics object. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified point is inside the visible clipping region of this Graphics object. |

Graphics::IsVisible | The Graphics::IsVisible method determines whether the specified rectangle intersects the visible clipping region of this Graphics object. |

Graphics::IsVisible | |

Graphics::IsVisibleClipEmpty | The Graphics::IsVisibleClipEmpty method determines whether the visible clipping region of this Graphics object is empty. The visible clipping region is the intersection of the clipping region of this Graphics object and the clipping region of the window. |

Graphics::MeasureCharacterRanges | The Graphics::MeasureCharacterRanges method gets a set of regions each of which bounds a range of character positions within a string. |

Graphics::MeasureDriverString | The Graphics::MeasureDriverString method measures the bounding box for the specified characters and their corresponding positions. |

Graphics::MeasureString | The Graphics::MeasureString method measures the extent of the string in the specified font, format, and layout rectangle. |

Graphics::MeasureString | The Graphics::MeasureString method measures the extent of the string in the specified font, format, and layout rectangle. |

Graphics::MeasureString | The Graphics::MeasureString method measures the extent of the string in the specified font and layout rectangle. |

Graphics::MeasureString | The Graphics::MeasureString method measures the extent of the string in the specified font and layout rectangle. |

Graphics::MultiplyTransform | The Graphics::MultiplyTransform method updates this Graphics object's world transformation matrix with the product of itself and another matrix. |

Graphics::ReleaseHDC | The Graphics::ReleaseHDC method releases a device context handle obtained by a previous call to the Graphics::GetHDC method of this Graphics object. |

Graphics::ResetClip | The Graphics::ResetClip method sets the clipping region of this Graphics object to an infinite region. |

Graphics::ResetTransform | The Graphics::ResetTransform method sets the world transformation matrix of this Graphics object to the identity matrix. |

Graphics::Restore | The Graphics::Restore method sets the state of this Graphics object to the state stored by a previous call to the Graphics::Save method of this Graphics object. |

Graphics::RotateTransform | The Graphics::RotateTransform method updates the world transformation matrix of this Graphics object with the product of itself and a rotation matrix. |

Graphics::Save | The Graphics::Save method saves the current state (transformations, clipping region, and quality settings) of this Graphics object. You can restore the state later by calling the Graphics::Restore method. |

Graphics::ScaleTransform | The Graphics::ScaleTransform method updates this Graphics object's world transformation matrix with the product of itself and a scaling matrix. |

Graphics::SetAbort | Not used in Windows GDI+ versions 1.0 and 1.1. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and a rectangle. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and a rectangle. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and the region specified by a graphics path. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and the region specified by a Region object. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and a Windows Graphics Device Interface (GDI) region. |

Graphics::SetCompositingMode | The Graphics::SetCompositingMode method sets the compositing mode of this Graphics object. |

Graphics::SetCompositingQuality | The Graphics::SetCompositingQuality method sets the compositing quality of this Graphics object. |

Graphics::SetInterpolationMode | The Graphics::SetInterpolationMode method sets the interpolation mode of this Graphics object. The interpolation mode determines the algorithm that is used when images are scaled or rotated. |

Graphics::SetPageScale | The Graphics::SetPageScale method sets the scaling factor for the page transformation of this Graphics object. The page transformation converts page coordinates to device coordinates. |

Graphics::SetPageUnit | The Graphics::SetPageUnit method sets the unit of measure for this Graphics object. The page unit belongs to the page transformation, which converts page coordinates to device coordinates. |

Graphics::SetPixelOffsetMode | The Graphics::SetPixelOffsetMode method sets the pixel offset mode of this Graphics object. |

Graphics::SetRenderingOrigin | The Graphics::SetRenderingOrigin method sets the rendering origin of this Graphics object. The rendering origin is used to set the dither origin for 8-bits-per-pixel and 16-bits-per-pixel dithering and is also used to set the origin for hatch brushes. |

Graphics::SetSmoothingMode | The Graphics::SetSmoothingMode method sets the rendering quality of the Graphics object. |

Graphics::SetTextContrast | The Graphics::SetTextContrast method sets the contrast value of this Graphics object. The contrast value is used for antialiasing text. |

Graphics::SetTextRenderingHint | The Graphics::SetTextRenderingHint method sets the text rendering mode of this Graphics object. |

Graphics::SetTransform | The Graphics::SetTransform method sets the world transformation of this Graphics object. |

Graphics::TransformPoints | The Graphics::TransformPoints method converts an array of points from one coordinate space to another. The conversion is based on the current world and page transformations of this Graphics object. |

Graphics::TranslateClip | The Graphics::TranslateClip method translates the clipping region of this Graphics object. |

Graphics::TranslateTransform | The Graphics::TranslateTransform method updates this Graphics object's world transformation matrix with the product of itself and a translation matrix. |

Graphics::BeginContainer | The Graphics::BeginContainer method begins a new graphics container. |

Graphics::DrawArc | The Graphics::DrawArc method draws an arc. |

Graphics::DrawBezier | The Graphics::DrawBezier method draws a Bezier spline. |

Graphics::DrawBeziers | The Graphics::DrawBeziers method draws a sequence of connected Bezier splines. |

Graphics::DrawClosedCurve | The Graphics::DrawClosedCurve method draws a closed cardinal spline. |

Graphics::DrawCurve | The Graphics::DrawCurve method draws a cardinal spline. |

Graphics::DrawEllipse | The Graphics::DrawEllipse method draws an ellipse. |

Graphics::DrawImage | The Graphics::DrawImage method draws an image. |

Graphics::DrawLine | The Graphics::DrawLine method draws a line that connects two points. |

Graphics::DrawLines | The Graphics::DrawLines method draws a sequence of connected lines. |

Graphics::DrawPie | The Graphics::DrawPie method draws a pie. |

Graphics::DrawPolygon | The Graphics::DrawPolygon method draws a polygon. |

Graphics::DrawRectangle | The Graphics::DrawRectangle method draws a rectangle. |

Graphics::DrawRectangles | The Graphics::DrawRectangles method draws a sequence of rectangles. |

Graphics::DrawString | The Graphics::DrawString method draws a string based on a font, a layout rectangle, and a format. |

Graphics::EnumerateMetafile | |

Graphics::ExcludeClip | The Graphics::ExcludeClip method updates the clipping region to the portion of itself that does not intersect the specified rectangle. |

Graphics::FillClosedCurve | The Graphics::FillClosedCurve method creates a closed cardinal spline from an array of points and uses a brush to fill the interior of the spline. |

Graphics::FillEllipse | The Graphics::FillEllipse method uses a brush to fill the interior of an ellipse that is specified by a rectangle. |

Graphics::FillPie | The Graphics::FillPie method uses a brush to fill the interior of a pie. |

Graphics::FillPolygon | The Graphics::FillPolygon method uses a brush to fill the interior of a polygon. |

Graphics::FillRectangle | The Graphics::FillRectangle method uses a brush to fill the interior of a rectangle. |

Graphics::FillRectangles | The Graphics::FillRectangles method uses a brush to fill the interior of a sequence of rectangles. |

Graphics::GetClipBounds | The Graphics::GetClipBounds method gets a rectangle that encloses the clipping region of this Graphics object. |

Graphics::GetVisibleClipBounds | The Graphics::GetVisibleClipBounds method gets a rectangle that encloses the visible clipping region of this Graphics object. |

Graphics::Graphics | Creates a Graphics::Graphics object that is associated with a specified device context. |

Graphics::IntersectClip | The Graphics::IntersectClip method updates the clipping region of this Graphics object. |

Graphics::IsVisible | |

Graphics::MeasureString | The Graphics::MeasureString method measures the extent of the string in the specified font, format, and layout rectangle. |

Graphics::SetClip | The Graphics::SetClip method updates the clipping region of this Graphics object. |

Graphics::TransformPoints | The Graphics::TransformPoints method converts an array of points from one coordinate space to another. The conversion is based on the current world and page transformations of this Graphics object. |

Graphics::TranslateClip | The Graphics::TranslateClip method translates the clipping region of this Graphics object. |

## Requirements

Target Platform |
Windows |

Header |
gdiplusgraphics.h |