GraphicsPath
System.Drawing.Drawing2D.GraphicsPath
Namespace: System.Drawing.Drawing2D
Assembly: System.Drawing.Managed (4.0.0.0)
Represents a series of connected lines and curves. This class cannot be inherited.
public class GraphicsPath : MarshalByRefObject, ICloneable, IDisposablePublic Class GraphicsPath
Inherits MarshalByRefObject
Implements ICloneable, IDisposableConstructors
GraphicsPath()
Initializes a new instance of the GraphicsPath class with a FillMode value of Alternate.
GraphicsPath(fillMode)
Initializes a new instance of the GraphicsPath class with the specified FillMode enumeration.
fillMode
The FillMode enumeration that determines how the interior of this GraphicsPath is filled.
GraphicsPath(pts, types)
Initializes a new instance of the GraphicsPath class with the specified Point array and Byte arrays.
pts
An array of Point structures that defines the coordinates of the points that make up this GraphicsPath.
types
An array of PathPointType enumeration elements that specifies the type of each corresponding point in the pts array.
GraphicsPath(pts, types, fillMode)
Initializes a new instance of the GraphicsPath class with the specified PointF array and Byte arrays.
pts
An array of PointF structures that defines the coordinates of the points that make up this GraphicsPath.
types
An array of PathPointType enumeration elements that specifies the type of each corresponding point in the pts array.
fillMode
The FillMode enumeration that determines how the interior of this GraphicsPath is filled.
GraphicsPath(pts, types)
Initializes a new instance of the GraphicsPath class with the specified PathPointType and Point arrays and with the specified FillMode enumeration element.
pts
An array of Point structures that defines the coordinates of the points that make up this GraphicsPath.
types
An array of PathPointType enumeration elements that specifies the type of each corresponding point in the pts array.
GraphicsPath(pts, types, fillMode)
Initializes a new instance of the GraphicsPath class with the specified PathPointType and PointF arrays and with the specified FillMode enumeration element.
pts
An array of PointF structures that defines the coordinates of the points that make up this GraphicsPath.
types
An array of PathPointType enumeration elements that specifies the type of each corresponding point in the pts array.
fillMode
The FillMode enumeration that determines how the interior of this GraphicsPath is filled.
Properties
FillMode
FillMode: Gets or sets a FillMode enumeration that determines how the interiors of shapes in this GraphicsPath are filled.
PathData
PathData: Gets a PathData that encapsulates arrays of points (points) and types (types) for this GraphicsPath.
PathPoints
PointF[]: Gets the points in the path.
PathTypes
Byte[]: Gets the types of the corresponding points in the PathPoints array.
PointCount
Int32: Gets the number of elements in the PathPoints or the PathTypes array.
Methods
AddArc(rect, startAngle, sweepAngle)
Appends an elliptical arc to the current figure.
rect
A RectangleF that represents the rectangular bounds of the ellipse from which the arc is taken.
If there are previous lines or curves in the figure, a line is added to connect the endpoint of the previous segment to the beginning of the arc. The arc is traced along the perimeter of the ellipse bounded by the specified rectangle.The starting point of the arc is determined by measuring clockwise from the x-axis of the ellipse (at the 0-degree angle) by the number of degrees in the start angle.The endpoint is similarly located by measuring clockwise from the starting point by the number of degrees in the sweep angle.If the sweep angle is greater than 360 degrees or less than -360 degrees, the arc is swept by exactly 360 degrees or -360 degrees, respectively.
AddArc(x, y, width, height, startAngle, sweepAngle)
Appends an elliptical arc to the current figure.
x
The x-coordinate of the upper-left corner of the rectangular region that defines the ellipse from which the arc is drawn.
y
The y-coordinate of the upper-left corner of the rectangular region that defines the ellipse from which the arc is drawn.
width
The width of the rectangular region that defines the ellipse from which the arc is drawn.
height
The height of the rectangular region that defines the ellipse from which the arc is drawn.
AddArc(rect, startAngle, sweepAngle)
Appends an elliptical arc to the current figure.
rect
A RectangleF that represents the rectangular bounds of the ellipse from which the arc is taken.
If there are previous lines or curves in the figure, a line is added to connect the endpoint of the previous segment to the beginning of the arc. The arc is traced along the perimeter of the ellipse bounded by the specified rectangle.The starting point of the arc is determined by measuring clockwise from the x-axis of the ellipse (at the 0-degree angle) by the number of degrees in the start angle.The endpoint is similarly located by measuring clockwise from the starting point by the number of degrees in the sweep angle.If the sweep angle is greater than 360 degrees or less than -360 degrees, the arc is swept by exactly 360 degrees or -360 degrees, respectively.
AddArc(x, y, width, height, startAngle, sweepAngle)
Appends an elliptical arc to the current figure.
x
The x-coordinate of the upper-left corner of the rectangular region that defines the ellipse from which the arc is drawn.
y
The y-coordinate of the upper-left corner of the rectangular region that defines the ellipse from which the arc is drawn.
height
The height of the rectangular region that defines the ellipse from which the arc is drawn.
AddBezier(pt1, pt2, pt3, pt4)
Adds a cubic Bézier curve to the current figure.
The cubic curve is constructed from the first point to the fourth point by using the second and third points as control points. If there is a previous line or curve segment in the figure, a line is added to connect the endpoint of the previous segment to the starting point of the cubic curve.
AddBezier(x1, y1, x2, y2, x3, y3, x4, y4)
Adds a cubic Bézier curve to the current figure.
The cubic curve is constructed from the first point to the fourth point by using the second and third points as control points. If there is a previous line or curve segment in the figure, a line is added to connect the endpoint of the previous segment to the starting point of the cubic curve.
AddBezier(pt1, pt2, pt3, pt4)
Adds a cubic Bézier curve to the current figure.
The cubic curve is constructed from the first point to the fourth point by using the second and third points as control points. If there is a previous line or curve segment in the figure, a line is added to connect the endpoint of the previous segment to the starting point of the cubic curve.
AddBezier(x1, y1, x2, y2, x3, y3, x4, y4)
Adds a cubic Bézier curve to the current figure.
The cubic curve is constructed from the first point to the fourth point by using the second and third points as control points. If there is a previous line or curve segment in the figure, a line is added to connect the endpoint of the previous segment to the starting point of the cubic curve.
AddBeziers(points)
Adds a sequence of connected cubic Bézier curves to the current figure.
AddBeziers(points)
Adds a sequence of connected cubic Bézier curves to the current figure.
AddClosedCurve(points)
Adds a closed curve to this path. A cardinal spline curve is used because the curve travels through each of the points in the array.
AddClosedCurve(points, tension)
Adds a closed curve to this path. A cardinal spline curve is used because the curve travels through each of the points in the array.
AddClosedCurve(points)
Adds a closed curve to this path. A cardinal spline curve is used because the curve travels through each of the points in the array.
AddClosedCurve(points, tension)
Adds a closed curve to this path. A cardinal spline curve is used because the curve travels through each of the points in the array.
AddCurve(points)
Adds a spline curve to the current figure.
AddCurve(points)
Adds a spline curve to the current figure.
AddCurve(points, tension)
Adds a spline curve to the current figure.
AddCurve(points, tension)
Adds a spline curve to the current figure.
AddCurve(points, offset, numberOfSegments, tension)
Adds a spline curve to the current figure.
offset
The index of the element in the points array that is used as the first point in the curve.
numberOfSegments
The number of segments used to draw the curve. A segment can be thought of as a line connecting two points.
tension
A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.
AddCurve(points, offset, numberOfSegments, tension)
Adds a spline curve to the current figure.
offset
The index of the element in the points array that is used as the first point in the curve.
numberOfSegments
The number of segments used to draw the curve. A segment can be thought of as a line connecting two points.
tension
A value that specifies the amount that the curve bends between control points. Values greater than 1 produce unpredictable results.
AddEllipse(x, y, width, height)
Adds an ellipse to the current path.
x
The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.
y
The y-coordinate of the upper left corner of the bounding rectangle that defines the ellipse.
AddEllipse(x, y, width, height)
Adds an ellipse to the current path.
AddEllipse(rect)
Adds an ellipse to the current path.
AddEllipse(rect)
Adds an ellipse to the current path.
AddLine(x1, y1, x2, y2)
Appends a line segment to this GraphicsPath.
AddLine(x1, y1, x2, y2)
Appends a line segment to this GraphicsPath.
AddLine(pt1, pt2)
Appends a line segment to this GraphicsPath.
AddLine(pt1, pt2)
Appends a line segment to this GraphicsPath.
AddLines(points)
Appends a series of connected line segments to the end of this GraphicsPath.
AddLines(points)
Appends a series of connected line segments to the end of this GraphicsPath.
AddPath(addingPath, connect)
Appends the specified GraphicsPath to this path.
connect
A 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 (if possible) 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.
AddPie(rect, startAngle, sweepAngle)
Adds the outline of a pie shape to this path.
rect
A Rectangle that represents the bounding rectangle that defines the ellipse from which the pie is drawn.
startAngle
The starting angle for the pie section, measured in degrees clockwise from the x-axis.
sweepAngle
The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle .
AddPie(x, y, width, height, startAngle, sweepAngle)
Adds the outline of a pie shape to this path.
x
The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.
y
The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.
height
The height of the bounding rectangle that defines the ellipse from which the pie is drawn.
startAngle
The starting angle for the pie section, measured in degrees clockwise from the x-axis.
sweepAngle
The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle .
AddPie(x, y, width, height, startAngle, sweepAngle)
Adds the outline of a pie shape to this path.
x
The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.
y
The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie is drawn.
width
The width of the bounding rectangle that defines the ellipse from which the pie is drawn.
height
The height of the bounding rectangle that defines the ellipse from which the pie is drawn.
startAngle
The starting angle for the pie section, measured in degrees clockwise from the x-axis.
sweepAngle
The angle between startAngle and the end of the pie section, measured in degrees clockwise from startAngle .
AddPolygon(points)
Adds a polygon to this path.
AddPolygon(points)
Adds a polygon to this path.
AddRectangle(rect)
Adds a rectangle to this path.
AddRectangle(rect)
Adds a rectangle to this path.
AddRectangles(rects)
Adds a series of rectangles to this path.
AddRectangles(rects)
Adds a series of rectangles to this path.
AddString(s, family, style, emSize, origin, format)
Adds a text string to this path.
style
A FontStyle enumeration that represents style information about the text (bold, italic, and so on). This must be cast as an integer.
format
A StringFormat that specifies text formatting information, such as line spacing and alignment.
AddString(s, family, style, emSize, origin, format)
Adds a text string to this path.
style
A FontStyle enumeration that represents style information about the text (bold, italic, and so on). This must be cast as an integer.
format
A StringFormat that specifies text formatting information, such as line spacing and alignment.
AddString(s, family, style, emSize, layoutRect, format)
Adds a text string to this path.
style
A FontStyle enumeration that represents style information about the text (bold, italic, and so on). This must be cast as an integer.
format
A StringFormat that specifies text formatting information, such as line spacing and alignment.
AddString(s, family, style, emSize, layoutRect, format)
Adds a text string to this path.
style
A FontStyle enumeration that represents style information about the text (bold, italic, and so on). This must be cast as an integer.
format
A StringFormat that specifies text formatting information, such as line spacing and alignment.
ClearMarkers()
Clears all markers from this path.
Clone()
Returns: Object.
CloseAllFigures()
Closes all open figures in this path and starts a new figure. It closes each open figure by connecting a line from its endpoint to its starting point.
CloseFigure()
Closes the current figure and starts a new figure. If the current figure contains a sequence of connected lines and curves, the method closes the loop by connecting a line from the endpoint to the starting point.
Dispose()
Finalize()
Finalizes an instance of the GraphicsPath class.
Flatten()
Converts each curve in this GraphicsPath into a sequence of connected line segments.
Flatten(matrix)
Converts each curve in this GraphicsPath into a sequence of connected line segments.
Flatten(matrix, flatness)
Converts each curve in this GraphicsPath into a sequence of connected line segments.
flatness
Specifies 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()
Returns a rectangle that bounds this GraphicsPath.
Returns: RectangleF. RectangleF.
GetBounds(matrix)
Returns a rectangle that bounds this GraphicsPath.
Returns: RectangleF. RectangleF.
GetBounds(matrix, pen)
Returns a rectangle that bounds this GraphicsPath.
matrix
The Matrix that specifies a transformation to be applied to this path before the bounding rectangle is calculated. This path is not permanently transformed; the transformation is used only during the process of calculating the bounding rectangle.
Returns: RectangleF. RectangleF.
GetLastPoint()
Gets the last point in the PathPoints array of this GraphicsPath.
IsVisible(point)
Indicates whether the specified point is contained within this GraphicsPath.
Returns: Boolean. Returns true if the specified point is contained within this GraphicsPath; otherwise, false.
IsVisible(point)
Indicates whether the specified point is contained within this GraphicsPath.
Returns: Boolean. Returns true if the specified point is contained within this GraphicsPath; otherwise, false.
Reset()
Empties the PathPoints and PathTypes arrays and sets the FillMode to Alternate.
Reverse()
Reverses the order of the points in this GraphicsPath.
SetMarkers()
Sets a marker on this GraphicsPath.
StartFigure()
Starts a new figure without closing the current figure. All subsequent points added to the path are added to this new figure.
Transform(matrix)
Applies a transform matrix to this GraphicsPath.
Widen(pen)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
Widen(pen, matrix)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
Widen(pen, matrix, flatness)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
Last updated
Was this helpful?