I need to be able to have a link connected to another link. I have to nodes connected by a link and I want to connect a third node but the from of that link should be bound to the center of the previous link (not to either of the previous nodes).
Sure–just use a GoLabeledLink to connect the first two nodes, and have the GoLabeledLink.MidLabel be a GoPort, at which you can connect a second link (of any type) that goes to (or from) the third node.
You can set the Size and Style and Pen and Brush and other properties of the GoPort to suit your needs.
Only now I don’t know how to set the ToNode of the CreateLink to a GoNode. I have not found what property I need to use to identify the port. If I try to access the Ports.Current it throws an exception.
You didn’t say what kind of nodes you are using. Some nodes only have a single port, that is accessible via the Port property. Some nodes may have more than one port–you need to figure out how to get the one you want given what properties and methods the node provides.
GoBasicNode a = new GoBasicNode(); … and set properties of A and Add to goView1.Document …
GoBasicNode b = new GoBasicNode(); … and set properties of B and Add to goView1.Document …
GoBasicNode c = new GoBasicNode(); … and set properties of C and Add to goView1.Document …
// link A to B
GoLabeledLink link1 = new GoLabeledLink(); … and set properties of LINK1 …
link1.FromPort = a.Port;
link1.ToPort = b.Port;
GoPort p = new GoPort(); … and set properties of P …
link1.MidLabel = p;
goView1.Document.LinksLayer.Add(link1); // add to document
// link C to LINK1’s port P
GoLink link2 = new GoLink(); … and set properties of LINK2 …
link2.FromPort = c.Port;
link2.ToPort = p;
goView1.Document.LinksLayer.Add(link2); // add to document
Sorry about that.
I am new to the product and I was creating GoNodes not GoBasicNodes. I found that refactoring for latter type now gives me the Port property I needed.
Thanks again you have been a great help.