public static GraphicsPath CreateRoundRectPath(Rectangle rect, Size size)
{
var gp = new GraphicsPath();
gp.AddLine(rect.Left + size.Width / 2, rect.Top, rect.Right - size.Width / 2, rect.Top);
gp.AddArc(rect.Right - size.Width, rect.Top, size.Width, size.Height, 270, 90);
gp.AddLine(rect.Right, rect.Top + size.Height / 2, rect.Right, rect.Bottom - size.Width / 2);
gp.AddArc(rect.Right - size.Width, rect.Bottom - size.Height, size.Width, size.Height, 0, 90);
gp.AddLine(rect.Right - size.Width / 2, rect.Bottom, rect.Left + size.Width / 2, rect.Bottom);
gp.AddArc(rect.Left, rect.Bottom - size.Height, size.Width, size.Height, 90, 90);
gp.AddLine(rect.Left, rect.Bottom - size.Height / 2, rect.Left, rect.Top + size.Height / 2);
gp.AddArc(rect.Left, rect.Top, size.Width, size.Height, 180, 90);
return gp;
}