• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class Graphics

Encapsulates a GDI+ drawing surface and provides methods for rendering shapes, text, and images.

Inheritance
object
Graphics
RecordingGraphics
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing
Assembly: DRIT.Drawing.dll
Syntax
public class Graphics : IDisposable
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Constructors

Graphics(Bitmap)

Initializes a new Graphics instance associated with the specified bitmap.

Declaration
protected Graphics(Bitmap target)
Parameters
Type Name Description
Bitmap target

The target bitmap for drawing operations.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Properties

Clip

Gets or sets the clipping region for this Graphics.

Declaration
public Region Clip { get; set; }
Property Value
Type Description
Region
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ClipBounds

Gets the bounding rectangle of the clipping region.

Declaration
public RectangleF ClipBounds { get; }
Property Value
Type Description
RectangleF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

CompositingMode

Gets or sets the compositing mode for rendering.

Declaration
public CompositingMode CompositingMode { get; set; }
Property Value
Type Description
CompositingMode
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

CompositingQuality

Gets or sets the compositing quality for rendering.

Declaration
public CompositingQuality CompositingQuality { get; set; }
Property Value
Type Description
CompositingQuality
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DpiX

Gets the horizontal resolution of the graphics context in pixels per inch.

Declaration
public virtual float DpiX { get; }
Property Value
Type Description
float
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DpiY

Gets the vertical resolution of the graphics context in pixels per inch.

Declaration
public virtual float DpiY { get; }
Property Value
Type Description
float
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FontFallback

Gets or sets the fallback font chain used when the selected font does not contain a requested glyph.

Declaration
public FontFallbackChain? FontFallback { get; set; }
Property Value
Type Description
FontFallbackChain
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Height

Gets the height of the drawing surface in pixels.

Declaration
public virtual int Height { get; }
Property Value
Type Description
int
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

InterpolationMode

Gets or sets the interpolation mode for scaling and rotating images.

Declaration
public InterpolationMode InterpolationMode { get; set; }
Property Value
Type Description
InterpolationMode
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IsClipEmpty

Gets a value indicating whether the clipping region is empty.

Declaration
public bool IsClipEmpty { get; }
Property Value
Type Description
bool
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IsRecording

Gets a value indicating whether this graphics surface is a recording (non-raster) surface. When true, DRIT.Drawing.Graphics._target is null and raster core methods are never called.

Declaration
protected virtual bool IsRecording { get; }
Property Value
Type Description
bool
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

PageScale

Gets or sets the scaling factor for page coordinates.

Declaration
public float PageScale { get; set; }
Property Value
Type Description
float
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

PageUnit

Gets or sets the unit of measure for page coordinates.

Declaration
public GraphicsUnit PageUnit { get; set; }
Property Value
Type Description
GraphicsUnit
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

PixelOffsetMode

Gets or sets the pixel offset mode for rendering.

Declaration
public PixelOffsetMode PixelOffsetMode { get; set; }
Property Value
Type Description
PixelOffsetMode
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

RenderingOrigin

Gets or sets the rendering origin point for the graphics context.

Declaration
public Point RenderingOrigin { get; set; }
Property Value
Type Description
Point
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

SmoothingMode

Gets or sets the smoothing mode for rendering lines and curves.

Declaration
public SmoothingMode SmoothingMode { get; set; }
Property Value
Type Description
SmoothingMode
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

TextRenderingHint

Gets or sets the text rendering hint for text quality.

Declaration
public TextRenderingHint TextRenderingHint { get; set; }
Property Value
Type Description
TextRenderingHint
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Transform

Gets or sets the world transformation matrix for this Graphics.

Declaration
public Matrix Transform { get; set; }
Property Value
Type Description
Matrix
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

VisibleClipBounds

Gets the visible clipping bounds.

Declaration
public RectangleF VisibleClipBounds { get; }
Property Value
Type Description
RectangleF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Width

Gets the width of the drawing surface in pixels.

Declaration
public virtual int Width { get; }
Property Value
Type Description
int
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Methods

BeginContainer()

Begins a graphics container and saves the current state.

Declaration
public virtual GraphicsContainer BeginContainer()
Returns
Type Description
GraphicsContainer

The graphics container.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

BeginContainer(RectangleF, RectangleF, GraphicsUnit)

Begins a graphics container with the specified destination and source rectangles and unit.

Declaration
public virtual GraphicsContainer BeginContainer(RectangleF dstRect, RectangleF srcRect, GraphicsUnit unit)
Parameters
Type Name Description
RectangleF dstRect

The destination rectangle.

RectangleF srcRect

The source rectangle.

GraphicsUnit unit

The graphics unit for the rectangles.

Returns
Type Description
GraphicsContainer

The graphics container.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Clear(Color)

Clears the graphics surface with the specified color.

Declaration
public void Clear(Color color)
Parameters
Type Name Description
Color color

The color to clear with.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ClearCore(Color)

Core implementation that clears the surface. Override in a recording surface to capture the command instead of rasterizing.

Declaration
protected virtual void ClearCore(Color color)
Parameters
Type Name Description
Color color
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

CopyFromScreen(int, int, int, int, Size)

Copies a block of pixels from the screen to the graphics surface.

Declaration
public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
Parameters
Type Name Description
int sourceX

The x-coordinate of the source location.

int sourceY

The y-coordinate of the source location.

int destinationX

The x-coordinate of the destination location.

int destinationY

The y-coordinate of the destination location.

Size blockRegionSize

The size of the block to copy.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Exceptions
Type Condition
PlatformNotSupportedException

Always thrown as screen capture is not supported.

Dispose()

Releases all resources used by the Graphics object.

Declaration
public void Dispose()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawArc(Pen, RectangleF, float, float)

Draws an arc defined by a bounding rectangle, start angle, and sweep angle with the specified pen.

Declaration
public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
Parameters
Type Name Description
Pen pen

The pen to draw with.

RectangleF rect

The bounding rectangle of the arc.

float startAngle

The start angle of the arc in degrees.

float sweepAngle

The sweep angle of the arc in degrees.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawBezier(Pen, PointF, PointF, PointF, PointF)

Draws a Bézier spline defined by four points with the specified pen.

Declaration
public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF pt1

The starting point.

PointF pt2

The first control point.

PointF pt3

The second control point.

PointF pt4

The ending point.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawBeziers(Pen, PointF[])

Draws a series of Bézier splines with the specified pen.

Declaration
public void DrawBeziers(Pen pen, PointF[] points)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points defining the splines.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawClosedCurve(Pen, PointF[], float, FillMode)

Draws a closed curve through a series of points with the specified pen.

Declaration
public void DrawClosedCurve(Pen pen, PointF[] points, float tension = 0.5, FillMode fillMode = FillMode.Alternate)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points to draw through.

float tension

The tension of the curve (default 0.5).

FillMode fillMode

The fill mode for the curve (default Alternate).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawCurve(Pen, PointF[], float)

Draws a curve through a series of points with the specified pen.

Declaration
public void DrawCurve(Pen pen, PointF[] points, float tension = 0.5)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points to draw through.

float tension

The tension of the curve (default 0.5).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawEllipse(Pen, Rectangle)

Draws an ellipse defined by a bounding rectangle with the specified pen.

Declaration
public void DrawEllipse(Pen pen, Rectangle rect)
Parameters
Type Name Description
Pen pen

The pen to draw with.

Rectangle rect

The bounding rectangle of the ellipse.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawEllipse(Pen, RectangleF)

Draws an ellipse defined by a bounding rectangle with the specified pen.

Declaration
public void DrawEllipse(Pen pen, RectangleF rect)
Parameters
Type Name Description
Pen pen

The pen to draw with.

RectangleF rect

The bounding rectangle of the ellipse.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Point)

Draws the specified image at the specified point.

Declaration
public void DrawImage(Image image, Point point)
Parameters
Type Name Description
Image image

The image to draw.

Point point

The point where the image will be drawn.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF)

Draws the specified image at the specified point.

Declaration
public void DrawImage(Image image, PointF point)
Parameters
Type Name Description
Image image

The image to draw.

PointF point

The point where the image will be drawn.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF, RectangleF, GraphicsUnit)

Draws the specified portion of the image at the specified point.

Declaration
public void DrawImage(Image image, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

PointF destPoint

The point where the image will be drawn.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF, RectangleF, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image at the specified point with the specified attributes.

Declaration
public void DrawImage(Image image, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

PointF destPoint

The point where the image will be drawn.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF[])

Draws the specified image transformed to fit the specified array of points.

Declaration
public void DrawImage(Image image, PointF[] destPoints)
Parameters
Type Name Description
Image image

The image to draw.

PointF[] destPoints

An array of points that define a parallelogram.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF[], RectangleF, GraphicsUnit)

Draws the specified portion of the image transformed to fit the specified array of points.

Declaration
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

PointF[] destPoints

An array of points that define a parallelogram.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image transformed to fit the specified array of points with the specified attributes.

Declaration
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

PointF[] destPoints

An array of points that define a parallelogram.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Point[])

Draws the specified image transformed to fit the specified array of points.

Declaration
public void DrawImage(Image image, Point[] destPoints)
Parameters
Type Name Description
Image image

The image to draw.

Point[] destPoints

An array of points that define a parallelogram.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle)

Draws the specified image scaled to fit the specified rectangle.

Declaration
public void DrawImage(Image image, Rectangle destRect)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, Rectangle, GraphicsUnit)

Draws the specified portion of the image scaled to fit the specified destination rectangle.

Declaration
public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

Rectangle srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, Rectangle, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image scaled to fit the specified destination rectangle with the specified attributes.

Declaration
public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

Rectangle srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, int, int, int, int, GraphicsUnit)

Draws the specified portion of the image scaled to fit the specified destination rectangle.

Declaration
public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

int srcX

The x-coordinate of the source rectangle.

int srcY

The y-coordinate of the source rectangle.

int srcWidth

The width of the source rectangle.

int srcHeight

The height of the source rectangle.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, int, int, int, int, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image scaled to fit the specified destination rectangle with the specified attributes.

Declaration
public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

int srcX

The x-coordinate of the source rectangle.

int srcY

The y-coordinate of the source rectangle.

int srcWidth

The width of the source rectangle.

int srcHeight

The height of the source rectangle.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, float, float, float, float, GraphicsUnit)

Draws the specified portion of the image scaled to fit the specified destination rectangle.

Declaration
public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

float srcX

The x-coordinate of the source rectangle.

float srcY

The y-coordinate of the source rectangle.

float srcWidth

The width of the source rectangle.

float srcHeight

The height of the source rectangle.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, Rectangle, float, float, float, float, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image scaled to fit the specified destination rectangle with the specified attributes.

Declaration
public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle destRect

The rectangle that specifies the location and size of the drawn image.

float srcX

The x-coordinate of the source rectangle.

float srcY

The y-coordinate of the source rectangle.

float srcWidth

The width of the source rectangle.

float srcHeight

The height of the source rectangle.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, RectangleF)

Draws the specified image scaled to fit the specified rectangle.

Declaration
public void DrawImage(Image image, RectangleF destRect)
Parameters
Type Name Description
Image image

The image to draw.

RectangleF destRect

The rectangle that specifies the location and size of the drawn image.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, RectangleF, RectangleF, GraphicsUnit)

Draws the specified portion of the image scaled to fit the specified destination rectangle.

Declaration
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
Parameters
Type Name Description
Image image

The image to draw.

RectangleF destRect

The rectangle that specifies the location and size of the drawn image.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, RectangleF, RectangleF, GraphicsUnit, ImageAttributes?)

Draws the specified portion of the image scaled to fit the specified destination rectangle with the specified attributes.

Declaration
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image

The image to draw.

RectangleF destRect

The rectangle that specifies the location and size of the drawn image.

RectangleF srcRect

The portion of the image to draw.

GraphicsUnit srcUnit

The unit of measure for the source rectangle.

ImageAttributes imageAttr

The image attributes to use for drawing.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, int, int)

Draws the specified image at the specified coordinates.

Declaration
public void DrawImage(Image image, int x, int y)
Parameters
Type Name Description
Image image

The image to draw.

int x

The x-coordinate of the location.

int y

The y-coordinate of the location.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImage(Image, float, float)

Draws the specified image at the specified coordinates.

Declaration
public void DrawImage(Image image, float x, float y)
Parameters
Type Name Description
Image image

The image to draw.

float x

The x-coordinate of the location.

float y

The y-coordinate of the location.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImageCore(Image, PointF[], RectangleF, GraphicsUnit, ImageAttributes?)

Core implementation that draws an affine-transformed image. Override in a recording surface to capture the command instead of rasterizing.

Declaration
protected virtual void DrawImageCore(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image
PointF[] destPoints
RectangleF srcRect
GraphicsUnit srcUnit
ImageAttributes imageAttr
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImageCore(Image, RectangleF, RectangleF, GraphicsUnit, ImageAttributes?)

Core implementation that draws a scaled image. Override in a recording surface to capture the command instead of rasterizing.

Declaration
protected virtual void DrawImageCore(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes? imageAttr)
Parameters
Type Name Description
Image image
RectangleF destRect
RectangleF srcRect
GraphicsUnit srcUnit
ImageAttributes imageAttr
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImageUnscaled(Image, Point)

Draws the specified image at the specified point without scaling.

Declaration
public void DrawImageUnscaled(Image image, Point point)
Parameters
Type Name Description
Image image

The image to draw.

Point point

The point where the image will be drawn.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawImageUnscaledAndClipped(Image, Rectangle)

Draws the specified image at the specified point without scaling and clips if necessary.

Declaration
public void DrawImageUnscaledAndClipped(Image image, Rectangle rect)
Parameters
Type Name Description
Image image

The image to draw.

Rectangle rect

The rectangle that specifies the location and size of the drawn image.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawLine(Pen, PointF, PointF)

Draws a line connecting two points with the specified pen.

Declaration
public void DrawLine(Pen pen, PointF pt1, PointF pt2)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF pt1

The first point.

PointF pt2

The second point.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawLine(Pen, int, int, int, int)

Draws a line connecting two points with the specified pen.

Declaration
public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
Parameters
Type Name Description
Pen pen

The pen to draw with.

int x1

The x-coordinate of the first point.

int y1

The y-coordinate of the first point.

int x2

The x-coordinate of the second point.

int y2

The y-coordinate of the second point.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawLine(Pen, float, float, float, float)

Draws a line connecting two points with the specified pen.

Declaration
public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
Parameters
Type Name Description
Pen pen

The pen to draw with.

float x1

The x-coordinate of the first point.

float y1

The y-coordinate of the first point.

float x2

The x-coordinate of the second point.

float y2

The y-coordinate of the second point.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawLines(Pen, PointF[])

Draws a series of line segments connecting an array of points.

Declaration
public void DrawLines(Pen pen, PointF[] points)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points to connect.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPath(Pen, GraphicsPath)

Draws a path defined by a GraphicsPath object with the specified pen.

Declaration
public void DrawPath(Pen pen, GraphicsPath path)
Parameters
Type Name Description
Pen pen

The pen to draw with.

GraphicsPath path

The GraphicsPath to draw.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPathCore(Pen, GraphicsPath)

Core implementation that strokes a graphics path. Override in a recording surface to capture the command instead of rasterizing.

Declaration
protected virtual void DrawPathCore(Pen pen, GraphicsPath path)
Parameters
Type Name Description
Pen pen

The pen to stroke with.

GraphicsPath path

The path to stroke.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPie(Pen, RectangleF, float, float)

Draws a pie shape defined by an ellipse and two radial lines with the specified pen.

Declaration
public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
Parameters
Type Name Description
Pen pen

The pen to draw with.

RectangleF rect

The bounding rectangle of the pie.

float startAngle

The start angle of the pie in degrees.

float sweepAngle

The sweep angle of the pie in degrees.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPolygon(Pen, PointF[])

Draws a polygon defined by an array of points with the specified pen.

Declaration
public void DrawPolygon(Pen pen, PointF[] points)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points defining the polygon.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPolygon16(Pen, PointF[])

Draws a polygon while requesting a native 16-bit polygon record on vector outputs.

Declaration
public void DrawPolygon16(Pen pen, PointF[] points)
Parameters
Type Name Description
Pen pen

The pen to draw with.

PointF[] points

The array of points defining the polygon.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawPolylineGroup(Pen, IReadOnlyList<PointF[]>)

Draws multiple disconnected polylines with the specified pen. Recording surfaces preserve the disconnected figures as one grouped vector operation when the target format supports it.

Declaration
public void DrawPolylineGroup(Pen pen, IReadOnlyList<PointF[]> polylines)
Parameters
Type Name Description
Pen pen

The pen to draw with.

IReadOnlyList<PointF[]> polylines

The disconnected polylines to draw.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRectangle(Pen, Rectangle)

Draws a rectangle with the specified pen.

Declaration
public void DrawRectangle(Pen pen, Rectangle rect)
Parameters
Type Name Description
Pen pen

The pen to draw with.

Rectangle rect

The rectangle to draw.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRectangle(Pen, RectangleF)

Draws a rectangle with the specified pen.

Declaration
public void DrawRectangle(Pen pen, RectangleF rect)
Parameters
Type Name Description
Pen pen

The pen to draw with.

RectangleF rect

The rectangle to draw.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRectangle(Pen, float, float, float, float)

Draws a rectangle with the specified pen.

Declaration
public void DrawRectangle(Pen pen, float x, float y, float width, float height)
Parameters
Type Name Description
Pen pen

The pen to draw with.

float x

The x-coordinate of the rectangle.

float y

The y-coordinate of the rectangle.

float width

The width of the rectangle.

float height

The height of the rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRectangles(Pen, RectangleF[])

Draws a series of rectangles with the specified pen.

Declaration
public void DrawRectangles(Pen pen, RectangleF[] rects)
Parameters
Type Name Description
Pen pen

The pen to draw with.

RectangleF[] rects

The array of rectangles to draw.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRichText(string, RichTextOptions, Brush, RectangleF)

Draws formatted rich text within the specified layout rectangle.

Declaration
public void DrawRichText(string text, RichTextOptions options, Brush defaultBrush, RectangleF layoutRect)
Parameters
Type Name Description
string text
RichTextOptions options
Brush defaultBrush
RectangleF layoutRect
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawRichText(string, RichTextOptions, Brush, RectangleF, StringFormat?)

Draws formatted rich text within the specified layout rectangle.

Declaration
public void DrawRichText(string text, RichTextOptions options, Brush defaultBrush, RectangleF layoutRect, StringFormat? format)
Parameters
Type Name Description
string text
RichTextOptions options
Brush defaultBrush
RectangleF layoutRect
StringFormat format
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, PointF)

Draws the specified text at the specified point with the specified brush and font.

Declaration
public void DrawString(string s, Font font, Brush brush, PointF point)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

PointF point

The point representing the text location.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, PointF, StringFormat?)

Draws the specified text at the specified point with the specified brush, font, and format.

Declaration
public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat? format)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

PointF point

The point representing the text location.

StringFormat format

The string format, or null for default.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, RectangleF)

Draws the specified text in the specified layout rectangle with the specified brush and font.

Declaration
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRect)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

RectangleF layoutRect

The layout rectangle for the text.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, RectangleF, StringFormat?)

Draws the specified text in the specified layout rectangle with the specified brush, font, and format.

Declaration
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRect, StringFormat? format)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

RectangleF layoutRect

The layout rectangle for the text.

StringFormat format

The string format, or null for default.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, float, float)

Draws the specified text at the specified location with the specified brush and font.

Declaration
public void DrawString(string s, Font font, Brush brush, float x, float y)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

float x

The x-coordinate of the text location.

float y

The y-coordinate of the text location.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawString(string, Font, Brush, float, float, StringFormat?)

Draws the specified text at the specified location with the specified brush, font, and format.

Declaration
public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat? format)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

float x

The x-coordinate of the text location.

float y

The y-coordinate of the text location.

StringFormat format

The string format, or null for default.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawStringCore(string, Font, Brush, RectangleF, StringFormat?)

Draws text using the supplied string, font, brush, and layout rectangle.

Declaration
protected virtual void DrawStringCore(string s, Font font, Brush brush, RectangleF layoutRect, StringFormat? format)
Parameters
Type Name Description
string s
Font font
Brush brush
RectangleF layoutRect
StringFormat format
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawStringOnPath(string, Font, Brush, GraphicsPath)

Draws the specified text along the given baseline path. Each glyph is positioned on the path and rotated to follow the path tangent.

Declaration
public void DrawStringOnPath(string s, Font font, Brush brush, GraphicsPath baselinePath)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

GraphicsPath baselinePath

The baseline path along which to lay out the text, in the current page units.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawStringOnPath(string, Font, Brush, GraphicsPath, StringFormat?)

Draws the specified text along the given baseline path.

Declaration
public void DrawStringOnPath(string s, Font font, Brush brush, GraphicsPath baselinePath, StringFormat? format)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

GraphicsPath baselinePath

The baseline path along which to lay out the text, in the current page units.

StringFormat format

The string format (only Alignment is used), or null for default.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

DrawStringOnPath(string, Font, Brush, GraphicsPath, StringFormat?, TextOnPathOptions?)

Draws the specified text along the given baseline path.

Declaration
public void DrawStringOnPath(string s, Font font, Brush brush, GraphicsPath baselinePath, StringFormat? format, TextOnPathOptions? options)
Parameters
Type Name Description
string s

The text to draw.

Font font

The font to draw with.

Brush brush

The brush to draw the text with.

GraphicsPath baselinePath

The baseline path along which to lay out the text, in the current page units.

StringFormat format

The string format (only Alignment is used), or null for default.

TextOnPathOptions options

Placement options (start offset, perpendicular offset, overflow), or null for defaults. Offsets are in the current page units.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

EndContainer(GraphicsContainer)

Ends a graphics container and restores the previous state.

Declaration
public virtual void EndContainer(GraphicsContainer container)
Parameters
Type Name Description
GraphicsContainer container

The graphics container to end.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ExcludeClip(Region)

Excludes the specified region from the clipping region.

Declaration
public void ExcludeClip(Region region)
Parameters
Type Name Description
Region region

The region to exclude.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ExcludeClip(Rectangle)

Excludes the specified rectangle from the clipping region.

Declaration
public void ExcludeClip(Rectangle rect)
Parameters
Type Name Description
Rectangle rect

The rectangle to exclude.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillClosedCurve(Brush, PointF[], FillMode, float)

Fills the interior of a closed curve with the specified brush.

Declaration
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode = FillMode.Alternate, float tension = 0.5)
Parameters
Type Name Description
Brush brush

The brush to fill with.

PointF[] points

The array of points defining the curve.

FillMode fillMode

The fill mode for the curve (default Alternate).

float tension

The tension of the curve (default 0.5).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillEllipse(Brush, Rectangle)

Fills the interior of an ellipse defined by a bounding rectangle with the specified brush.

Declaration
public void FillEllipse(Brush brush, Rectangle rect)
Parameters
Type Name Description
Brush brush

The brush to fill with.

Rectangle rect

The bounding rectangle of the ellipse.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillEllipse(Brush, RectangleF)

Fills the interior of an ellipse defined by a bounding rectangle with the specified brush.

Declaration
public void FillEllipse(Brush brush, RectangleF rect)
Parameters
Type Name Description
Brush brush

The brush to fill with.

RectangleF rect

The bounding rectangle of the ellipse.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPath(Brush, GraphicsPath)

Fills the interior of a path defined by a GraphicsPath object with the specified brush.

Declaration
public void FillPath(Brush brush, GraphicsPath path)
Parameters
Type Name Description
Brush brush

The brush to fill with.

GraphicsPath path

The GraphicsPath to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPath(Brush, GraphicsPath, FillMode)

Fills the interior of a path defined by a GraphicsPath object with the specified brush and fill mode.

Declaration
public void FillPath(Brush brush, GraphicsPath path, FillMode fillMode)
Parameters
Type Name Description
Brush brush

The brush to fill with.

GraphicsPath path

The GraphicsPath to fill.

FillMode fillMode

The fill mode.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPathCore(Brush, GraphicsPath, FillMode)

Core implementation that fills a graphics path. Override in a recording surface to capture the command instead of rasterizing.

Declaration
protected virtual void FillPathCore(Brush brush, GraphicsPath path, FillMode fillMode)
Parameters
Type Name Description
Brush brush
GraphicsPath path
FillMode fillMode
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPie(Brush, RectangleF, float, float)

Fills the interior of a pie shape defined by an ellipse and two radial lines with the specified brush.

Declaration
public void FillPie(Brush brush, RectangleF rect, float startAngle, float sweepAngle)
Parameters
Type Name Description
Brush brush

The brush to fill with.

RectangleF rect

The bounding rectangle of the pie.

float startAngle

The start angle of the pie in degrees.

float sweepAngle

The sweep angle of the pie in degrees.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPolygon(Brush, PointF[], FillMode)

Fills the interior of a polygon defined by an array of points with the specified brush.

Declaration
public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode = FillMode.Alternate)
Parameters
Type Name Description
Brush brush

The brush to fill with.

PointF[] points

The array of points defining the polygon.

FillMode fillMode

The fill mode for the polygon (default Alternate).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPolygon16(Brush, PointF[])

Fills a polygon while requesting a native 16-bit polygon record on vector outputs.

Declaration
public void FillPolygon16(Brush brush, PointF[] points)
Parameters
Type Name Description
Brush brush

The brush to fill with.

PointF[] points

The array of points defining the polygon.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillPolygons16(Brush, PointF[][])

Fills a group of polygons while requesting a native 16-bit polygon-group record on vector outputs.

Declaration
public void FillPolygons16(Brush brush, PointF[][] polygons)
Parameters
Type Name Description
Brush brush

The brush to fill with.

PointF[][] polygons

The polygon point arrays to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillRectangle(Brush, Rectangle)

Fills the interior of a rectangle with the specified brush.

Declaration
public void FillRectangle(Brush brush, Rectangle rect)
Parameters
Type Name Description
Brush brush

The brush to fill with.

Rectangle rect

The rectangle to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillRectangle(Brush, RectangleF)

Fills the interior of a rectangle with the specified brush.

Declaration
public void FillRectangle(Brush brush, RectangleF rect)
Parameters
Type Name Description
Brush brush

The brush to fill with.

RectangleF rect

The rectangle to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillRectangle(Brush, float, float, float, float)

Fills the interior of a rectangle with the specified brush.

Declaration
public void FillRectangle(Brush brush, float x, float y, float width, float height)
Parameters
Type Name Description
Brush brush

The brush to fill with.

float x

The x-coordinate of the rectangle.

float y

The y-coordinate of the rectangle.

float width

The width of the rectangle.

float height

The height of the rectangle.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillRectangles(Brush, RectangleF[])

Fills the interiors of a series of rectangles with the specified brush.

Declaration
public void FillRectangles(Brush brush, RectangleF[] rects)
Parameters
Type Name Description
Brush brush

The brush to fill with.

RectangleF[] rects

The array of rectangles to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FillRegion(Brush, Region)

Fills the interior of a region with the specified brush.

Declaration
public void FillRegion(Brush brush, Region region)
Parameters
Type Name Description
Brush brush

The brush to fill with.

Region region

The region to fill.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Flush()

Flushes the graphics buffer to the output device.

Declaration
public void Flush()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Flush(FlushIntention)

Flushes the graphics buffer to the output device with the specified intention.

Declaration
public void Flush(FlushIntention intention)
Parameters
Type Name Description
FlushIntention intention

The flush intention.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

FromHdc(IntPtr)

Creates a Graphics object from a device context handle.

Declaration
public static Graphics FromHdc(IntPtr hdc)
Parameters
Type Name Description
IntPtr hdc

The device context handle.

Returns
Type Description
Graphics

A new Graphics instance.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Exceptions
Type Condition
PlatformNotSupportedException

Always thrown as HDC-backed Graphics is not supported.

FromHwnd(IntPtr)

Creates a Graphics object from a window handle.

Declaration
public static Graphics FromHwnd(IntPtr hwnd)
Parameters
Type Name Description
IntPtr hwnd

The window handle.

Returns
Type Description
Graphics

A new Graphics instance.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Exceptions
Type Condition
PlatformNotSupportedException

Always thrown as HWND-backed Graphics is not supported.

FromImage(Image)

Creates a Graphics object from the specified image.

Declaration
public static Graphics FromImage(Image image)
Parameters
Type Name Description
Image image

The image to create the graphics context from.

Returns
Type Description
Graphics

A new Graphics instance.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Exceptions
Type Condition
ArgumentNullException

Thrown when image is null.

NotSupportedException

Thrown when the image is not a Bitmap.

GetNearestColor(Color)

Gets the nearest color to the specified color.

Declaration
public Color GetNearestColor(Color color)
Parameters
Type Name Description
Color color

The color to find the nearest match for.

Returns
Type Description
Color

The nearest color.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IntersectClip(Region)

Intersects the clipping region with the specified region.

Declaration
public void IntersectClip(Region region)
Parameters
Type Name Description
Region region

The region to intersect with.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IntersectClip(Rectangle)

Intersects the clipping region with the specified rectangle.

Declaration
public void IntersectClip(Rectangle rect)
Parameters
Type Name Description
Rectangle rect

The rectangle to intersect with.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IntersectClip(RectangleF)

Intersects the clipping region with the specified rectangle.

Declaration
public void IntersectClip(RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to intersect with.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IsVisible(PointF)

Determines whether the specified point is visible within the clipping region.

Declaration
public bool IsVisible(PointF point)
Parameters
Type Name Description
PointF point

The point to check.

Returns
Type Description
bool

True if the point is visible; otherwise, false.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

IsVisible(RectangleF)

Determines whether the specified rectangle is visible within the clipping region.

Declaration
public bool IsVisible(RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to check.

Returns
Type Description
bool

True if the rectangle is visible; otherwise, false.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureRichText(string, RichTextOptions, SizeF)

Measures rich text within the specified layout area.

Declaration
public SizeF MeasureRichText(string text, RichTextOptions options, SizeF layoutArea)
Parameters
Type Name Description
string text
RichTextOptions options
SizeF layoutArea
Returns
Type Description
SizeF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureRichText(string, RichTextOptions, SizeF, StringFormat?)

Measures the formatted rich text within the specified layout area.

Declaration
public SizeF MeasureRichText(string text, RichTextOptions options, SizeF layoutArea, StringFormat? format)
Parameters
Type Name Description
string text
RichTextOptions options
SizeF layoutArea
StringFormat format
Returns
Type Description
SizeF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureString(string, Font)

Measures the specified text when drawn with the specified font.

Declaration
public SizeF MeasureString(string text, Font font)
Parameters
Type Name Description
string text

The text to measure.

Font font

The font to measure with.

Returns
Type Description
SizeF

The size of the text in pixels.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureString(string, Font, PointF, StringFormat?)

Measures the specified text when drawn with the specified font at the specified origin and format.

Declaration
public SizeF MeasureString(string text, Font font, PointF origin, StringFormat? format)
Parameters
Type Name Description
string text

The text to measure.

Font font

The font to measure with.

PointF origin

The origin point in the current page units.

StringFormat format

The string format, or null for default.

Returns
Type Description
SizeF

The size of the text in pixels.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureString(string, Font, SizeF)

Measures the specified text when drawn with the specified font within the specified layout area.

Declaration
public SizeF MeasureString(string text, Font font, SizeF layoutArea)
Parameters
Type Name Description
string text

The text to measure.

Font font

The font to measure with.

SizeF layoutArea

The layout area in the current page units.

Returns
Type Description
SizeF

The size of the text in pixels.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureString(string, Font, SizeF, StringFormat?)

Measures the specified text when drawn with the specified font within the specified layout area and format.

Declaration
public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat? format)
Parameters
Type Name Description
string text

The text to measure.

Font font

The font to measure with.

SizeF layoutArea

The layout area in the current page units.

StringFormat format

The string format, or null for default.

Returns
Type Description
SizeF

The size of the text in pixels.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MeasureString(string, Font, int)

Measures the specified text when drawn with the specified font within the specified width.

Declaration
public SizeF MeasureString(string text, Font font, int width)
Parameters
Type Name Description
string text

The text to measure.

Font font

The font to measure with.

int width

The maximum width in pixels.

Returns
Type Description
SizeF

The size of the text in pixels.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

MultiplyTransform(Matrix, MatrixOrder)

Multiplies the world transformation matrix by the specified matrix.

Declaration
public void MultiplyTransform(Matrix matrix, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
Matrix matrix

The matrix to multiply.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

OnClipChanged()

Called after the clip region changes. Override in a recording surface to capture the new clip state.

Declaration
protected virtual void OnClipChanged()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

OnHintChanged(object)

Called after a rendering hint, page unit, page scale, or rendering origin changes. Override in a recording surface to capture the new value.

Declaration
protected virtual void OnHintChanged(object hintValue)
Parameters
Type Name Description
object hintValue

The new hint value.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

OnTransformChanged()

Called after the world transform changes. Override in a recording surface to capture the new transform state.

Declaration
protected virtual void OnTransformChanged()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ResetClip()

Resets the clipping region to the entire graphics surface.

Declaration
public void ResetClip()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ResetTransform()

Resets the world transformation matrix to the identity matrix.

Declaration
public void ResetTransform()
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Restore(GraphicsState)

Restores the graphics state to the specified state.

Declaration
public virtual void Restore(GraphicsState graphicsState)
Parameters
Type Name Description
GraphicsState graphicsState

The graphics state to restore.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

RotateTransform(float, MatrixOrder)

Rotates the world transformation matrix by the specified angle.

Declaration
public void RotateTransform(float angle, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float angle

The angle of rotation in degrees.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Save()

Saves the current graphics state and returns a GraphicsState object.

Declaration
public virtual GraphicsState Save()
Returns
Type Description
GraphicsState

The saved graphics state.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ScaleTransform(float, float, MatrixOrder)

Scales the world transformation matrix by the specified factors.

Declaration
public void ScaleTransform(float sx, float sy, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float sx

The horizontal scale factor.

float sy

The vertical scale factor.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

SetClip(GraphicsPath, CombineMode)

Sets the clipping region to the specified path.

Declaration
public void SetClip(GraphicsPath path, CombineMode combineMode = CombineMode.Replace)
Parameters
Type Name Description
GraphicsPath path

The path to clip to.

CombineMode combineMode

The combine mode for the clipping operation (default Replace).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

SetClip(Region, CombineMode)

Sets the clipping region to the specified region.

Declaration
public void SetClip(Region region, CombineMode combineMode = CombineMode.Replace)
Parameters
Type Name Description
Region region

The region to clip to.

CombineMode combineMode

The combine mode for the clipping operation (default Replace).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

SetClip(Rectangle, CombineMode)

Sets the clipping region to the specified rectangle.

Declaration
public void SetClip(Rectangle rect, CombineMode combineMode = CombineMode.Replace)
Parameters
Type Name Description
Rectangle rect

The rectangle to clip to.

CombineMode combineMode

The combine mode for the clipping operation (default Replace).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

SetClip(RectangleF, CombineMode)

Sets the clipping region to the specified rectangle.

Declaration
public void SetClip(RectangleF rect, CombineMode combineMode = CombineMode.Replace)
Parameters
Type Name Description
RectangleF rect

The rectangle to clip to.

CombineMode combineMode

The combine mode for the clipping operation (default Replace).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ToPointF(PointF)

Converts a point from the current page unit to pixel coordinates.

Declaration
protected PointF ToPointF(PointF p)
Parameters
Type Name Description
PointF p
Returns
Type Description
PointF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

ToRectangleF(RectangleF)

Converts a rectangle from the current page unit to pixel coordinates.

Declaration
protected RectangleF ToRectangleF(RectangleF r)
Parameters
Type Name Description
RectangleF r
Returns
Type Description
RectangleF
Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

TranslateClip(float, float)

Translates the clipping region by the specified amount.

Declaration
public void TranslateClip(float dx, float dy)
Parameters
Type Name Description
float dx

The horizontal translation.

float dy

The vertical translation.

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

TranslateTransform(float, float, MatrixOrder)

Translates the world transformation matrix by the specified offsets.

Declaration
public void TranslateTransform(float dx, float dy, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float dx

The horizontal translation.

float dy

The vertical translation.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A Graphics object is associated with a specific device context and is used to perform drawing operations. It is typically obtained from a Bitmap via FromImage(Image).

Implements

IDisposable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX