PathAddRoundedRectangle(RectangleF, Single) Method

Adds a rounded rectangle to this Path, applying the same corner radius to all corners.

Definition

Namespace: KGySoft.Drawing.Shapes
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 9.1.1
C#
public Path AddRoundedRectangle(
	RectangleF bounds,
	float cornerRadius
)

Parameters

bounds  RectangleF
The bounding rectangle that defines the rounded rectangle.
cornerRadius  Single
The size of the corner radius of the rounded rectangle for all corners.

Return Value

Path
This Path instance.

Remarks

The rounded rectangle is added as a new closed figure.

If cornerRadius is negative, the absolute value will be used. If it is greater than the half of the smaller side of the bounding rectangle, it will be adjusted to the half of the smaller side, so the result will be an oval shape. If the cornerRadius is 0, a simple rectangle will be added.

The coordinates of the specified bounding rectangle are not validated here but in the moment of drawing the coordinates of the possibly transformed path points must fall into the bounds of an int value; otherwise, an OverflowException will be thrown.

See Also