Remarks: This is a thin wrapper around the IGraphicsPath interface, which is created via Create().
Constructors
GraphicsPath
#Initializes a new instance of the GraphicsPath class.
Parameters:
| handler (IGraphicsPath) | Handler for the graphics path |
Properties
CurrentPoint
#Gets the current point
Remarks: If the current figure in the path is not closed, and StartFigure() is not called, the next segment will be connected from this point to its start point.
Value: The current point
Implements: CurrentPoint
Gets the platform-specific control object
Instantiator
#obsolete: Use Create() instead
Creates a delegate that can be used to create instances of the IGraphicsPath with little overhead
Remarks: This is useful when creating a very large number of graphics path objects
Methods
AddArc
#Adds an arc into the specified rectangle
Remarks: If the current figure is not closed, it will connect with the start of the arc. The current position will be moved to the ending point of the arc
Parameters:
| x (float) | The x coordinate of the upper left of the arc |
| y (float) | The y coordinate of the upper left of the arc |
| width (float) | Width of the rectangle containing the arc |
| height (float) | Height of the rectangle containing the arc |
| startAngle (float) | Start angle to begin the arc, in degrees |
| sweepAngle (float) | Sweep angle (positive or negative) to specify how long the arc is, in degrees |
Implements: AddArc
AddBezier
#Adds a bezier curve to the path with two control points
Remarks: If the current figure is not closed, it will connect with the
start of the bezier curve. The current position will be moved to the end point.Parameters:
| start (PointF) | Starting point of the bezier curve |
| control1 (PointF) | First control point of the curve |
| control2 (PointF) | Second control point of the curve |
| end (PointF) | Ending point of the bezier curve |
Implements: AddBezier
AddCurve
#Adds a curve that intersects with the specified
points to the pathRemarks: Each point in the list will fall on the line based on the
tension parameterParameters:
| points (IEnumerable<PointF>) | Points to calculate the curve |
| tension (float = 0.5) | Tension between points in the curve. Should be between 0 (no curve) and 1 (more curve) |
Implements: AddCurve
AddEllipse
#Adds an ellipse to the path
Remarks: Rectangles are separate figures and will not connect to the current or next figure in the path. The starting point of the path will no longer be set after this call.
Parameters:
| x (float) | X co-ordinate of the top left of the ellipse |
| y (float) | Y co-ordinate of the top left of the ellipse's bounding rectangle |
| width (float) | Width of the rectangle |
| height (float) | Height of the rectangle |
Implements: AddEllipse
AddLine
#Adds a line to the path with the specified start and end points
Remarks: If the current figure is not closed, it will connect with the start of this line. The current position will be moved to the specified end location.
Parameters:
| startX (float) | X co-ordinate of the starting point |
| startY (float) | Y co-ordinate of the starting point |
| endX (float) | X co-ordinate of the end point |
| endY (float) | Y co-ordinate of the end point |
Implements: AddLine
AddLines
#Adds lines to each of the specified
points to the pathRemarks: If the current figure is not closed, it will connect with the first point specified. The current position will be moved to the last point specified
Parameters:
| points (IEnumerable<PointF>) | Points for each part of the line |
Implements: AddLines
AddPath
#Adds the specified
path to the current path, optionally connecting the current figure to the start of the pathRemarks: The
connect parameter only specifies that the path should be connected to the current path at the beginning. The end of the specified path will always be connected to the next segment added to this path, unlesss CloseFigure() or StartFigure() are called after this.Parameters:
| path (IGraphicsPath) | Child path to add to this instance |
| connect (bool = false) | True to connect the current figure to the first figure of the specified path, if it is not closed |
Implements: AddPath
AddRectangle
#Adds a rectangle to the path
Remarks: Rectangles are separate figures and will not connect to the current or next figure in the path. The starting point of the path will no longer be set after this call.
Parameters:
| x (float) | X co-ordinate of the top left of the rectangle |
| y (float) | Y co-ordinate of the top left of the rectangle |
| width (float) | Width of the rectangle |
| height (float) | Height of the rectangle |
Implements: AddRectangle
CloseFigure
#public void CloseFigure()
Closes the current figure by connecting a line to the beginning of the figure
Remarks: This will also make the next segment added to the path start independently from the last figure. To start a new figure without closing the current one, use StartFigure()
Implements: CloseFigure
Dispose
#Disposes the graphics path
Parameters:
| disposing (bool) | If set to true dispose was called explicitly, otherwise specify false if calling from a finalizer |
FillContains
#Gets a value indicating that the specified
point is contained by the path when filledParameters:
| point (PointF) | Point to test |
Returns:
true if the path contains the point when filled, false otherwiseImplements: FillContains
GetRoundRect
#public static IGraphicsPath GetRoundRect(RectangleF rectangle, float nwRadius, float neRadius, float seRadius, float swRadius)
Creates a rounded rectangle using the specified corner radius
Parameters:
| rectangle (RectangleF) | Rectangle to round |
| nwRadius (float) | Radius of the north east corner |
| neRadius (float) | Radius of the north west corner |
| seRadius (float) | Radius of the south east corner |
| swRadius (float) | Radius of the south west corner |
Returns: GraphicsPath with the lines of the rounded rectangle ready to be painted
GetRoundRect
#Creates a rounded rectangle using the specified corner radius
Parameters:
| rectangle (RectangleF) | Rectangle to round |
| radius (float) | Radius for all corners |
Returns: The round rect.
GraphicsPath with the lines of the rounded rectangle ready to be painted
GraphicsPath with the lines of the rounded rectangle ready to be painted
MoveTo
#Moves the current position to the specified location without adding anything to the path
Implements: MoveTo
StartFigure
#public void StartFigure()
Starts a new figure without closing the current figure
Remarks: This will make the next segment added to the path independent (unconnected) to the last segment.
Implements: StartFigure
StrokeContains
#Gets a value indicating that the spedified
point is on the path when stroked with the specified penReturns:
true if the point is on the path when stroked with the specified pen, false otherwiseImplements: StrokeContains