Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Multiple anchor points (Read 3279 times)
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Multiple anchor points
Nov 21st, 2006 at 7:17am
Print Post  
Hello,

I'm currently evaluating FlowChart .NET and one thing I didn't find until now. Is it possible to connect multiple links to a node/table to multiple anchor points?

Ex.: On top of the node (box), I'd like to connect a various number of links. But each should get a single anchor point (5 links = 5 anchor points, equally distributed). Is something like this possible, or do I have to code this, and is it possible to code this with reasonable effort?

Best regards,

Alex
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multiple anchor points
Reply #1 - Nov 21st, 2006 at 8:01am
Print Post  
Hello,

You might define the anchor points using the AnchorPattern class and the Node.AnchorPattern property:

Code
Select All
AnchorPattern ap5;

private void Form1_Load(object sender, System.EventArgs e)
{
  fc.SnapToAnchor = SnapToAnchor.OnCreateOrModify;

  // define five incoming anchor points
  AnchorPointCollection points = new AnchorPointCollection();
  for (short i = 0; i < 5; i++)
  {
    points.Add(new AnchorPoint((short)(10 + i * 20), 0,
     true, false, MarkStyle.Circle, Color.Blue));
  }

  // and one outgoing
  points.Add(new AnchorPoint(50, 100, false, true));

  ap5 = new AnchorPattern(points);
  AnchorPattern.Register(ap5);
}

private void fc_InitializeBox(object sender, MindFusion.Diagramming.WinForms.BoxEventArgs e)
{
  // set the anchor points when users start to draw a new box
  e.Box.AnchorPattern = ap5;
}

private void fc_ValidateAnchorPoint(object sender, MindFusion.Diagramming.WinForms.AttachConfirmArgs e)
{
  // allow at most one arrow to connect to an anchor point
  if (numArrows(e.Node, e.AnchorIndex) > 0)
    e.Confirm = false;
}

private int numArrows(Node node, int anchorIndex)
{
  int total = 0;
  foreach (Arrow arrow in node.IncomingArrows)
    if (arrow.DestAnchor == anchorIndex)
     total++;

  return total;
}
 



Best regards,
Stoyan
  
Back to top
 
IP Logged
 
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Re: Multiple anchor points
Reply #2 - Nov 21st, 2006 at 8:17am
Print Post  
Thank you very much!

Finally found the correct Example  Smiley, but you were faster than me!

Very nice product!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint