How do you draw a rounded rectangle on a Canvas in .NET MAUI?

Platform: .NET MAUI| Category: General

Rounded rectangles and squares can be drawn on an ICanvas using the DrawRoundedRectangle method, which requires x, y, width, height, and cornerRadius arguments, of type float. The cornerRadius argument specifies the radius used to round the corners of the rectangle.
The following example shows how to draw a rounded rectangle:

C#

canvas.StrokeColor = Colors.Green;
canvas.StrokeSize = 4;
canvas.DrawRoundedRectangle(10, 10, 100, 50, 12);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.