public static void FillRoundedRectangle(this Graphics graphics, Brush brush, RectangleF bounds, float cornerRadius) { if (graphics == null) { throw new ArgumentNullException(nameof(graphics)); } if (brush == null) { throw new ArgumentNullException(nameof(brush)); } using (GraphicsPath path = RoundedRect(bounds, cornerRadius)) { graphics.FillPath(brush, path); } }
public static void DrawRoundedRectangle(this Graphics graphics, Pen pen, RectangleF bounds, float cornerRadius) { if (graphics == null) { throw new ArgumentNullException(nameof(graphics)); } if (pen == null) { throw new ArgumentNullException(nameof(pen)); } using (var path = RoundedRect(bounds, cornerRadius)) { graphics.DrawPath(pen, path); } }