public static GraphicsPath RoundRect(float x,
float y,
float w,
float h,
double r = 0.3,
bool TL = true,
bool TR = true,
bool BR = true,
bool BL = true)
{
float num = Math.Min(w, h) * (float)r;
float num2 = x + w;
float num3 = y + h;
GraphicsPath graphicsPath;
GraphicsPath result = graphicsPath = new GraphicsPath();
if (TL)
graphicsPath.AddArc(x, y,
num, num,
180f, 90f);
else
graphicsPath.AddLine(x, y, x, y);
if (TR)
graphicsPath.AddArc(num2 - num, y,
num, num,
270f, 90f);
else
graphicsPath.AddLine(num2, y,
num2, y);
if (BR)
graphicsPath.AddArc(num2 - num,
num3 - num, num,
num,
0f, 90f);
else
graphicsPath.AddLine(num2, num3,
num2, num3);
if (BL)
graphicsPath.AddArc(x, num3 - num,
num, num,
90f, 90f);
else
graphicsPath.AddLine(x, num3, x, num3);
graphicsPath.CloseFigure();
return result;
}