public static void RoundRect(CanvasContext2D ctx, int x, int y, int width, int height, int radius = 5, bool fill = true, bool stroke = false) { ctx.Save(); ctx.LineWidth = 3; ctx.BeginPath(); ctx.MoveTo(x + radius, y); ctx.LineTo(x + width, y); //ctx.quadraticCurveTo(x + width, y, x + width, y + radius); ctx.LineTo(x + width, y + height); // ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); ctx.LineTo(x, y + height); // ctx.quadraticCurveTo(x, y + height, x, y + height - radius); ctx.LineTo(x, y + radius); ctx.QuadraticCurveTo(x, y, x + radius, y); ctx.ClosePath(); if (stroke) ctx.Stroke(); if (fill) ctx.Fill(); ctx.Restore(); }