Draw a rounded rectangle on the Canvas.
Syntax

[C#]

XRect DrawRoundRect(double inWidth, double inHeight, DrawOptions inOptions);
XRect DrawRoundRect(double inWidth, double inHeight, DrawOptions inOptions, int inCornerWidth, int inCornerHeight);
XRect DrawRoundRect(XRect inRect, DrawOptions inOptions);
XRect DrawRoundRect(XRect inRect, DrawOptions inOptions, int inCornerWidth, int inCornerHeight);

[Visual Basic]

Function DrawRoundRect(inWidth As Double, inHeight As Double, inOptions As DrawOptions) As XRect
Function DrawRoundRect(inWidth As Double, inHeight As Double, inOptions As DrawOptions, inCornerWidth As Integer, inCornerHeight As Integer) As XRect
Function DrawRoundRect(inRect As XRect, inOptions As DrawOptions) As XRect
Function DrawRoundRect(inRect As XRect, inOptions As DrawOptions, inCornerWidth As Integer, inCornerHeight As Integer) As XRect
Params
Name Description
inWidth The rectangle width.
inHeight The rectangle height.
inOptions The draw options.
inCornerWidth The corner width.
inCornerHeight The corner height.
inRect The rectangle to draw.
return The drawn area.
Notes

Draw the specified rounded rectangle on the Canvas using the properties specified in DrawOptions. If only the size is specified, the rectangle will be positioned using the align properties in DrawOptions.

See Also

HAlign

VAlign

DrawOptions

Example

Here we paint a blue rounded rectangle on the Canvas, which is auto sized. We also set the size of the corners to 32 pixels - the default is 16.

Note that the Canvas size is set to 250x250 because we center the image (25 + 200 + 25 = 250). Size the Canvas manually if this is not what you want.

[C#]Canvas canvas = new Canvas();
DrawOptions drawOpts = new DrawOptions();
drawOpts.ShapeDrawing = DrawOptions.ShapeDrawingType.Paint;
drawOpts.PaintColor = new XColor(Color.Blue);
drawOpts.CornerSize = new Size(32, 32);
canvas.DrawRoundRect(new XRect(25, 25, 200, 200), drawOpts);
canvas.SaveAs(Server.MapPath("Canvas_DrawRoundRect_93.png"));


[Visual Basic]Dim canvas As New Canvas()
Dim drawOpts As New DrawOptions()
drawOpts.ShapeDrawing = DrawOptions.ShapeDrawingType.Paint
drawOpts.PaintColor = New XColor(Color.Blue)
drawOpts.CornerSize = New Size(32, 32)
canvas.DrawRoundRect(New XRect(25, 25, 200, 200), drawOpts)
canvas.SaveAs(Server.MapPath("Canvas_DrawRoundRect_93.png"))



Canvas_DrawRoundRect_93.png