Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


The function draws a rectangle with rounded corners.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 3.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.RoundRect"; PDF; PosX; PosY; Width; Height; Radius; FillMode )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
PosX X-Coordinate of rectangle $x
PosY Y-Coordinate of rectangle $y
Width Width of the rectangle $w
Height Height of the rectangle $h
Radius Radius of rounded corners. 20
FillMode Fill mode. Can be FillNoClose, StrokeNoClose, FillStrokeNoClose, Fill, Stroke, FillStroke, FillEvOdd, FillStrokeEvOdd, FillEvOddNoClose, FillStrokeEvOddNoClose, NoFill or Close. "fill"


Returns OK or error.


The function draws a rectangle with rounded corners.
The radius must not be greater than the half with or height of the rectangle.
If the coordinate system is bottom-up the point PosX, PosY defines the lower left corner of the rectangle. If the coordinate system is top-down it defines the upper left corner.
The draw direction can be changed with the function DynaPDF.SetDrawDirection.
A rectangle is a closed path that can be filled, stroked or both. It is also possible to draw a rectangle invisible to apply the filling rules nonzero winding number or even-odd. The filling rules are described under DynaPDF.ClipPath. The parameter FillMode is ignored if the rectangle is drawn inside a clipping path. The fill modes are described under DynaPDF.ClosePath.

See also RoundRect function in DynaPDF manual.


Draw round rectangle with blue:

Set Variable [ $r ; Value: MBS("DynaPDF.SetStrokeColor"; $pdf; 0; 0; 0) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0.8) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetLineWidth"; $pdf; 5) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.RoundRect"; $pdf; 100; 100; 300; 200; 20; "fillStroke" ) ]

See also

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 3th January 2021

DynaPDF.RotateTemplate - DynaPDF.RoundRectEx