Hello,
i got the following problem:
I draw a Box and want to change the AnchorPattern according to the number of arrows this Box is attached to.
I tried the following:
private void flowChart_ArrowCreated(object sender, ArrowEventArgs args)
{
//get count of Arrows
int incArrows = args.Arrow.Destination.IncomingArrows.Count;
int outArrows = args.Arrow.Destination.OutgoingArrows.Count;
// build new anchor points
AnchorPointCollection ap = new AnchorPointCollection();
int incomPat = 100 / (incArrows + 1);
int outgoPat = 100 / (outArrows + 1);
// distribute the anchors on the Box
for (int i = 0; i < incArrows+1; i++)
{
ap.Add(new AnchorPoint((short)((i+1)*incomPat), 25, true, false, MarkStyle.Circle, Color.Blue));
}
for (int i = 0; i < outArrows+1; i++)
{
ap.Add(new AnchorPoint((short)((i+1)*outgoPat), 75, false, true, MarkStyle.Circle, Color.Blue));
}
ap.Add(new AnchorPoint(100,50,true,true, MarkStyle.Cross, Color.Red));
AnchorPattern pat = new AnchorPattern(ap);
//assign the new anchor pattern to the Box
args.Arrow.Destination.AnchorPattern = pat;
//register all arrows to the new pattern!
ArrowCollection arCol = args.Arrow.Destination.IncomingArrows;
int counter = 0;
foreach (Arrow arrow in arCol)
{
arrow.DestAnchor = counter;
++counter;
}
}
Problem is, that the arrow aligns to the right place when created, but the already connected arrows do not realign.
Any ideas? I currently find no solution...
Thank you again!
Alex