PathAddRectangle(Single, Single, Single, Single) Method

Adds a rectangle to this Path.

Definition

Namespace: KGySoft.Drawing.Shapes
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 9.1.1
C#
public Path AddRectangle(
	float x,
	float y,
	float width,
	float height
)

Parameters

x  Single
The x-coordinate of the upper-left corner.
y  Single
The y-coordinate of the upper-left corner.
width  Single
The width of the rectangle.
height  Single
The height of the rectangle.

Return Value

Path
This Path instance.

Remarks

The rectangle is added as a new closed figure.

When filling a rectangle (with identity transformation), the width and height parameters specify the size of the rectangle in pixels.

When drawing a rectangle (with identity transformation), the right and bottom values are inclusive. If the width of the Pen is 1, a rectangle with zero width and height will be rendered as a single pixel.

The parameters 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