GraphicsPathExtensionsAddRoundedRectangle(GraphicsPath, RectangleF, Single) Method

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

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 10.0.0-rc.1
C#
public static void AddRoundedRectangle(
	this GraphicsPath path,
	RectangleF bounds,
	float cornerRadius
)

Parameters

path  GraphicsPath
The GraphicsPath instance to add the rounded rectangle to.
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.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type GraphicsPath. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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.

See Also