private GraphicsPath CreateBorderPath(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
switch (Orientation)
{
case VisualOrientation.Top:
path.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top + 2);
path.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
path.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
path.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
path.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 1);
path.AddLine(rect.Right - 1, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
break;
case VisualOrientation.Bottom:
path.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - 3);
path.AddLine(rect.Left, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 1);
path.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 1);
path.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 3);
path.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top);
path.AddLine(rect.Right - 1, rect.Top, rect.Left, rect.Top);
break;
case VisualOrientation.Left:
path.AddLine(rect.Right - 1, rect.Top, rect.Left + 2, rect.Top);
path.AddLine(rect.Left + 2, rect.Top, rect.Left, rect.Top + 2);
path.AddLine(rect.Left, rect.Top + 2, rect.Left, rect.Bottom - 3);
path.AddLine(rect.Left, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 1);
path.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
path.AddLine(rect.Right - 1, rect.Bottom - 1, rect.Right - 1, rect.Top);
break;
case VisualOrientation.Right:
path.AddLine(rect.Left, rect.Top, rect.Right - 3, rect.Top);
path.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
path.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
path.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
path.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
path.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top);
break;
}
return path;
}