PathAddRoundedRectangle(RectangleF, Single, Single, Single, Single) Method

Adds a rounded rectangle to this Path, applying a custom corner radius to each corner.

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 radiusTopLeft,
	float radiusTopRight,
	float radiusBottomRight,
	float radiusBottomLeft
)

Parameters

bounds  RectangleF
The bounding rectangle that defines the rounded rectangle.
radiusTopLeft  Single
The size of the top-left corner radius of the rounded rectangle.
radiusTopRight  Single
The size of the top-right corner radius of the rounded rectangle.
radiusBottomRight  Single
The size of the bottom-right corner radius of the rounded rectangle.
radiusBottomLeft  Single
The size of the bottom-left corner radius of the rounded rectangle.

Return Value

Path
This Path instance.

Remarks

The rounded rectangle is added as a new closed figure.

If any of the corner radius parameters is negative, the absolute value will be used. If the sum of any adjacent corner radius parameters is greater than the corresponding side of the bounding rectangle, then all corner radius parameters will be scaled down proportionally to fit into the bounding rectangle.

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