Class GraphicsPath
Represents a series of connected lines and curves. This class cannot be inherited.
public sealed class GraphicsPath : ObjectWithBounds
- Inheritance
-
GraphicsPath
- Inherited Members
Constructors
GraphicsPath()
Initializes a new instance of the GraphicsPath class.
public GraphicsPath()
GraphicsPath(Figure[])
Initializes a new instance of the GraphicsPath class.
public GraphicsPath(Figure[] figures)
Parameters
figures
Figure[]The figures to initialize from.
GraphicsPath(Figure[], FillMode)
Initializes a new instance of the GraphicsPath class.
public GraphicsPath(Figure[] figures, FillMode fillMode)
Parameters
GraphicsPath(FillMode)
Initializes a new instance of the GraphicsPath class.
public GraphicsPath(FillMode fillMode)
Parameters
fillMode
FillModeThe fill mode.
Properties
Bounds
Gets or sets the object's bounds.
public override RectangleF Bounds { get; }
Property Value
- RectangleF
The object's bounds.
Figures
Gets the path figures.
public Figure[] Figures { get; }
Property Value
- Figure[]
The path figures.
FillMode
Gets or sets a FillMode enumeration that determines how the interiors of shapes in this GraphicsPath are filled.
public FillMode FillMode { get; set; }
Property Value
- FillMode
The fill mode.
Methods
AddFigure(Figure)
Adds a new figure.
public void AddFigure(Figure figure)
Parameters
figure
FigureThe figure to add.
AddFigures(Figure[])
Adds new figures.
public void AddFigures(Figure[] figures)
Parameters
figures
Figure[]The figures to add.
AddPath(GraphicsPath)
Appends the specified GraphicsPath to this path.
public void AddPath(GraphicsPath addingPath)
Parameters
addingPath
GraphicsPathThe GraphicsPath to add.
AddPath(GraphicsPath, bool)
Appends the specified GraphicsPath to this path.
public void AddPath(GraphicsPath addingPath, bool connect)
Parameters
addingPath
GraphicsPathThe GraphicsPath to add.
connect
boolA Boolean value that specifies whether the first figure in the added path is part of the last figure in this path. A value of true specifies that the first figure in the added path is part of the last figure in this path. A value of false specifies that the first figure in the added path is separate from the last figure in this path.
DeepClone()
Performs a deep clone of this graphics path.
public GraphicsPath DeepClone()
Returns
- GraphicsPath
A deep clone of the graphics path.
Equals(object)
Check if objects are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe other object.
Returns
- bool
The equality comparison result.
Flatten()
Converts each curve in this path into a sequence of connected line segments.
public void Flatten()
Flatten(Matrix)
Applies the specified transform and then converts each curve in this GraphicsPath into a sequence of connected line segments.
public void Flatten(Matrix matrix)
Parameters
matrix
MatrixA Matrix by which to transform this GraphicsPath before flattening.
Flatten(Matrix, float)
Converts each curve in this GraphicsPath into a sequence of connected line segments.
public void Flatten(Matrix matrix, float flatness)
Parameters
matrix
MatrixA Matrix by which to transform this GraphicsPath before flattening.
flatness
floatSpecifies the maximum permitted error between the curve and its flattened approximation. A value of 0.25 is the default. Reducing the flatness value will increase the number of line segments in the approximation.
GetBounds(Matrix)
Gets the object's bounds.
public override RectangleF GetBounds(Matrix matrix)
Parameters
matrix
MatrixThe matrix to apply before bounds will be calculated.
Returns
- RectangleF
The estimated object's bounds.
GetBounds(Matrix, Pen)
Gets the object's bounds.
public override RectangleF GetBounds(Matrix matrix, Pen pen)
Parameters
matrix
MatrixThe matrix to apply before bounds will be calculated.
pen
PenThe pen to use for object. This can influence the object's bounds size.
Returns
- RectangleF
The estimated object's bounds.
GetHashCode()
Get hash code of the current object.
public override int GetHashCode()
Returns
- int
The hash code.
IsOutlineVisible(Point, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
public bool IsOutlineVisible(Point point, Pen pen)
Parameters
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath when drawn with the specified Pen; otherwise, false.
IsOutlineVisible(Point, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
public bool IsOutlineVisible(Point pt, Pen pen, Graphics graphics)
Parameters
pt
PointA Point that specifies the location to test.
pen
PenThe Pen to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath as drawn with the specified Pen; otherwise, false.
IsOutlineVisible(PointF, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
public bool IsOutlineVisible(PointF point, Pen pen)
Parameters
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath when drawn with the specified Pen; otherwise, false.
IsOutlineVisible(PointF, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
public bool IsOutlineVisible(PointF pt, Pen pen, Graphics graphics)
Parameters
pt
PointFA PointF that specifies the location to test.
pen
PenThe Pen to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within (under) the outline of this GraphicsPath as drawn with the specified Pen; otherwise, false.
IsOutlineVisible(int, int, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
public bool IsOutlineVisible(int x, int y, Pen pen)
Parameters
x
intThe x-coordinate of the point to test.
y
intThe y-coordinate of the point to test.
pen
PenThe Pen to test.
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath when drawn with the specified Pen; otherwise, false.
IsOutlineVisible(int, int, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
public bool IsOutlineVisible(int x, int y, Pen pen, Graphics graphics)
Parameters
x
intThe x-coordinate of the point to test.
y
intThe y-coordinate of the point to test.
pen
PenThe Pen to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath as drawn with the specified Pen; otherwise, false.
IsOutlineVisible(float, float, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
public bool IsOutlineVisible(float x, float y, Pen pen)
Parameters
x
floatThe x-coordinate of the point to test.
y
floatThe y-coordinate of the point to test.
pen
PenThe Pen to test.
Returns
- bool
This method returns true if the specified point is contained within the outline of this GraphicsPath when drawn with the specified Pen; otherwise, false.
IsOutlineVisible(float, float, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
public bool IsOutlineVisible(float x, float y, Pen pen, Graphics graphics)
Parameters
x
floatThe x-coordinate of the point to test.
y
floatThe y-coordinate of the point to test.
pen
PenThe Pen to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within (under) the outline of this GraphicsPath as drawn with the specified Pen; otherwise, false.
IsVisible(Point)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(Point point)
Parameters
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(Point, Graphics)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(Point pt, Graphics graphics)
Parameters
pt
PointA Point that represents the point to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(PointF)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(PointF point)
Parameters
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(PointF, Graphics)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(PointF pt, Graphics graphics)
Parameters
pt
PointFA PointF that represents the point to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within this; otherwise, false.
IsVisible(int, int)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(int x, int y)
Parameters
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(int, int, Graphics)
Indicates whether the specified point is contained within this GraphicsPath, using the specified Graphics.
public bool IsVisible(int x, int y, Graphics graphics)
Parameters
x
intThe x-coordinate of the point to test.
y
intThe y-coordinate of the point to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(float, float)
Indicates whether the specified point is contained within this GraphicsPath.
public bool IsVisible(float x, float y)
Parameters
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(float, float, Graphics)
Indicates whether the specified point is contained within this GraphicsPath in the visible clip region of the specified Graphics.
public bool IsVisible(float x, float y, Graphics graphics)
Parameters
x
floatThe x-coordinate of the point to test.
y
floatThe y-coordinate of the point to test.
graphics
GraphicsThe Graphics for which to test visibility.
Returns
- bool
This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.
RemoveFigure(Figure)
Removes a figure.
public void RemoveFigure(Figure figure)
Parameters
figure
FigureThe figure to remove.
RemoveFigures(Figure[])
Removes figures.
public void RemoveFigures(Figure[] figures)
Parameters
figures
Figure[]The figures to remove.
Reset()
public void Reset()
Reverse()
Reverses the order of figures, shapes, and points in each shape of this GraphicsPath.
public void Reverse()
Transform(Matrix)
Applies the specified transformation to the shape.
public override void Transform(Matrix transform)
Parameters
transform
MatrixThe transformation to apply.
Warp(PointF[], RectangleF)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
public void Warp(PointF[] destPoints, RectangleF srcRect)
Parameters
destPoints
PointF[]An array of PointF structures that define a parallelogram to which the rectangle defined by
srcRect
is transformed. The array can contain either three or four elements. If the array contains three elements, the lower-right corner of the parallelogram is implied by the first three points.srcRect
RectangleFA RectangleF that represents the rectangle that is transformed to the parallelogram defined by
destPoints
.
Warp(PointF[], RectangleF, Matrix)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix)
Parameters
destPoints
PointF[]An array of PointF structures that define a parallelogram to which the rectangle defined by
srcRect
is transformed. The array can contain either three or four elements. If the array contains three elements, the lower-right corner of the parallelogram is implied by the first three points.srcRect
RectangleFA RectangleF that represents the rectangle that is transformed to the parallelogram defined by
destPoints
.matrix
MatrixA Matrix that specifies a geometric transform to apply to the path.
Warp(PointF[], RectangleF, Matrix, WarpMode)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode)
Parameters
destPoints
PointF[]An array of PointF structures that defines a parallelogram to which the rectangle defined by
srcRect
is transformed. The array can contain either three or four elements. If the array contains three elements, the lower-right corner of the parallelogram is implied by the first three points.srcRect
RectangleFA RectangleF that represents the rectangle that is transformed to the parallelogram defined by
destPoints
.matrix
MatrixA Matrix that specifies a geometric transform to apply to the path.
warpMode
WarpModeA WarpMode enumeration that specifies whether this warp operation uses perspective or bilinear mode.
Warp(PointF[], RectangleF, Matrix, WarpMode, float)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode, float flatness)
Parameters
destPoints
PointF[]An array of PointF structures that define a parallelogram to which the rectangle defined by
srcRect
is transformed. The array can contain either three or four elements. If the array contains three elements, the lower-right corner of the parallelogram is implied by the first three points.srcRect
RectangleFA RectangleF that represents the rectangle that is transformed to the parallelogram defined by
destPoints
.matrix
MatrixA Matrix that specifies a geometric transform to apply to the path.
warpMode
WarpModeA WarpMode enumeration that specifies whether this warp operation uses perspective or bilinear mode.
flatness
floatA value from 0 through 1 that specifies how flat the resulting path is. For more information, see the Flatten() methods.
Widen(Pen)
Adds an additional outline to the path.
public void Widen(Pen pen)
Parameters
pen
PenA Pen that specifies the width between the original outline of the path and the new outline this method creates.
Widen(Pen, Matrix)
Adds an additional outline to the GraphicsPath.
public void Widen(Pen pen, Matrix matrix)
Parameters
pen
PenA Pen that specifies the width between the original outline of the path and the new outline this method creates.
matrix
MatrixA Matrix that specifies a transform to apply to the path before widening.
Widen(Pen, Matrix, float)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
public void Widen(Pen pen, Matrix matrix, float flatness)