Added DrawCapsule extension

This commit is contained in:
Jaex 2017-12-07 14:32:59 +03:00
parent b916341d16
commit 8af932445b

View file

@ -73,6 +73,11 @@ public static void DrawRoundedRectangle(this Graphics g, Pen pen, Rectangle rect
g.DrawRoundedRectangle(null, pen, rect, radius);
}
public static void DrawRoundedRectangle(this Graphics g, Brush brush, Rectangle rect, float radius)
{
g.DrawRoundedRectangle(brush, null, rect, radius);
}
public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, Rectangle rect, float radius)
{
using (GraphicsPath gp = new GraphicsPath())
@ -83,6 +88,15 @@ public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, R
}
}
public static void DrawCapsule(this Graphics g, Brush brush, Rectangle rect)
{
using (GraphicsPath gp = new GraphicsPath())
{
gp.AddCapsule(rect);
g.FillPath(brush, gp);
}
}
public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, int x, int y, int width, int height, float radius)
{
DrawRoundedRectangle(g, brush, pen, new Rectangle(x, y, width, height), radius);