private static void DrawJoinPath(Graphics g, int x1, int x2, int y1, int y2, bool transpose)
{
Point midpoint, c1, c2;
Point start = new Point(x1, y1);
Point end = new Point(x2, y2);
int skew = y2 - y1;
if (skew > 32)
{
int halfskew = skew / 2;
int qtrskew = halfskew / 2;
midpoint = new Point(x1 + (x2 - x1) / 2, y1 + halfskew);
c1 = new Point(x1 + 8, y1 + qtrskew);
c2 = new Point(x2 - 8, y2 - qtrskew);
}
else
{
midpoint = new Point(x1 + (x2 - x1) / 2, Math.Max(y1, y2) + 32);
c1 = new Point(x1 + 8, y1 + 16);
c2 = new Point(x2 - 8, y2 + 16);
}
if (transpose)
{
start = new Point(start.Y, start.X);
c1 = new Point(c1.Y, c1.X);
c2 = new Point(c2.Y, c2.X);
midpoint = new Point(midpoint.Y, midpoint.X);
end = new Point(end.Y, end.X);
}
GraphicsPath path = new GraphicsPath();
path.AddCurve(new Point[] { start, c1, midpoint, c2, end }, 0.5f);
g.DrawPath(joinPen, path);
}