private GraphicsPath CreateArrowPath(Rectangle rect)
{
int x, y;
// Find the correct starting position, which depends on direction
if ((Orientation == VisualOrientation.Left) ||
(Orientation == VisualOrientation.Right))
{
x = rect.Right - (rect.Width - 4) / 2;
y = rect.Y + rect.Height / 2;
}
else
{
x = rect.X + rect.Width / 2;
y = rect.Bottom - (rect.Height - 3) / 2;
}
// Create triangle using a series of lines
GraphicsPath path = new GraphicsPath();
switch (Orientation)
{
case VisualOrientation.Right:
path.AddLine(x, y, x - 4, y - 4);
path.AddLine(x - 4, y - 4, x - 4, y + 4);
path.AddLine(x - 4, y + 4, x, y);
break;
case VisualOrientation.Left:
path.AddLine(x - 4, y, x, y - 4);
path.AddLine(x, y - 4, x, y + 4);
path.AddLine(x, y + 4, x - 4, y);
break;
case VisualOrientation.Bottom:
path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
path.AddLine(x - 2f, y - 3f, x, y);
path.AddLine(x, y, x + 3f, y - 3f);
break;
case VisualOrientation.Top:
path.AddLine(x + 3f, y, x - 3f, y);
path.AddLine(x - 3f, y, x, y - 4f);
path.AddLine(x, y - 4f, x + 3f, y);
break;
}
return path;
}