This older thread shows one way to do this:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=115436435...and here is the code ported to the Flowchart.NET 5 API:
private void diagram_LinkCreated(object sender, LinkEventArgs e)
{
DiagramLinkCollection commonLinks = GetCommonLinks(e.Link.Origin, e.Link.Destination);
PointF pt1 = e.Link.ControlPoints[0];
PointF pt2 = e.Link.ControlPoints[e.Link.ControlPoints.Count - 1];
if (commonLinks.Count > 1)
{
for (int c = 0; c < commonLinks.Count; ++c)
{
DiagramLink link = commonLinks[c];
link.Style = LinkStyle.Bezier;
link.SegmentCount = 1;
PointF cp1 = new PointF(pt1.X + 1 * (pt2.X - pt1.X) / 3, pt1.Y + 1 * (pt2.Y - pt1.Y) / 3);
PointF cp2 = new PointF(pt1.X + 2 * (pt2.X - pt1.X) / 3, pt1.Y + 2 * (pt2.Y - pt1.Y) / 3);
float angle = 0, radius = 0;
CartesianToPolar(pt1, pt2, ref angle, ref radius);
int pairOffset = (c / 2 + 1) * 5;
if (commonLinks.Count % 2 == 0)
{
PolarToCartesian(cp1, c % 2 == 0 ? angle - 90 : angle + 90, pairOffset, ref cp1);
PolarToCartesian(cp2, c % 2 == 0 ? angle - 90 : angle + 90, pairOffset, ref cp2);
if (link.ControlPoints[0] == pt1)
{
link.ControlPoints[1] = cp1;
link.ControlPoints[2] = cp2;
}
else
{
link.ControlPoints[1] = cp2;
link.ControlPoints[2] = cp1;
}
link.UpdateFromPoints();
}
}
}
}
DiagramLinkCollection GetCommonLinks(DiagramNode node1, DiagramNode node2)
{
DiagramLinkCollection commonLinks = new DiagramLinkCollection();
foreach (DiagramLink link in node1.OutgoingLinks)
if (link.Destination == node2)
commonLinks.Add(link);
foreach (DiagramLink link in node1.IncomingLinks)
if (link.Origin == node2)
commonLinks.Add(link);
return commonLinks;
}
void PolarToCartesian(PointF coordCenter, float a, float r, ref PointF cartesian)
{
if (r == 0)
{
cartesian = coordCenter;
return;
}
cartesian.X = (float)(coordCenter.X + Math.Cos(a * Math.PI / 180) * r);
cartesian.Y = (float)(coordCenter.Y - Math.Sin(a * Math.PI / 180) * r);
}
void CartesianToPolar(PointF coordCenter, PointF cartesian, ref float a, ref float r)
{
if (coordCenter == cartesian)
{
a = 0;
r = 0;
return;
}
float dx = cartesian.X - coordCenter.X;
float dy = cartesian.Y - coordCenter.Y;
r = (float)(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)));
a = (float)(Math.Atan(-dy / dx) * 180 / Math.PI);
if (dx < 0) a += 180;
}
You could copy the LinkCreated code to a helper method and call it for each pair of nodes with more than one link between them.
I hope that helps,
Stoyan