private static void AddOneNotePath(GraphicsPath borderPath,
VisualOrientation orientation,
Rectangle rect,
bool forBorder,
int rp)
{
int x = Math.Min(Math.Min(9, rect.Width / 2), rect.Height / 2);
int rpW = Math.Min(rp, rect.Width / 2);
int rpH = Math.Min(rp, rect.Height / 2);
switch (orientation)
{
case VisualOrientation.Top:
if (!forBorder)
borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - 1);
borderPath.AddArc(rect.Left, rect.Top, x, x, 180f, 90f);
borderPath.AddLine(rect.Right - rpW, rect.Top, rect.Right, rect.Bottom);
break;
case VisualOrientation.Bottom:
if (!forBorder)
borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Top + 1);
borderPath.AddArc(rect.Left, rect.Bottom - x, x, x, 180f, -90f);
borderPath.AddLine(rect.Right - rpW, rect.Bottom, rect.Right, rect.Top);
break;
case VisualOrientation.Left:
if (!forBorder)
borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
borderPath.AddLine(rect.Right, rect.Top, rect.Right - 1, rect.Top);
borderPath.AddArc(rect.Left, rect.Top, x, x, -90f, -90f);
borderPath.AddLine(rect.Left, rect.Bottom - rpH, rect.Right, rect.Bottom);
break;
case VisualOrientation.Right:
if (!forBorder)
borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
borderPath.AddLine(rect.Left, rect.Top, rect.Left + 1, rect.Top);
borderPath.AddArc(rect.Right - x, rect.Top, x, x, -90f, 90f);
borderPath.AddLine(rect.Right, rect.Bottom - rpH, rect.Left, rect.Bottom);
break;
}
}