private static void AddSquarePath(GraphicsPath borderPath,
VisualOrientation orientation,
Rectangle rect,
bool forBorder)
{
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.Top);
borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
borderPath.AddLine(rect.Right, 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.Bottom);
borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
break;
case VisualOrientation.Left:
if (!forBorder)
borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
break;
case VisualOrientation.Right:
if (!forBorder)
borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
break;
}
}