We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to know links from/to a symbol

when I click a symbol, I want to know all links from it(TailPort) and all links to it (HeadPort). Any sample code? Thanks

2 Replies

AD Administrator Syncfusion Team October 19, 2004 02:18 PM

Hi You should use the IGraphNode Interface to accomplish what you are seeking. Run this sample and add a few Symbols and Links. Select a Symbol and click on the "Change Link Colors" button. Here is the code snippet which changes the colors of the links coming into and leaving out of the selected instance of MySymbol: if ((this.diagram1.SelectionList.Count == 1) || (this.diagram1.SelectionList.First.GetType() == typeof(MySymbol))) { IGraphNode curNode = this.diagram1.SelectionList.First as IGraphNode; if (curNode != null) { IEnumerator enumedgesEntering = curNode.EdgesEntering.GetEnumerator(); IEnumerator enumedgesLeaving = curNode.EdgesLeaving.GetEnumerator(); //Incoming Links - Blue ICollection edgesEntering = curNode.EdgesEntering; while (enumedgesEntering.MoveNext()) { Link incomingLink = enumedgesEntering.Current as Link; incomingLink.LineStyle.LineColor = Color.Blue; } //Incoming Links - Blue ICollection edgesLeaving = curNode.EdgesLeaving; while (enumedgesLeaving.MoveNext()) { Link leavingLink = enumedgesLeaving.Current as Link; leavingLink.LineStyle.LineColor = Color.Red; } this.diagram1.Refresh(); } } Regards Arun


AD Administrator Syncfusion Team October 26, 2004 10:12 AM

Thank you for help. Now my code works.

Loader.
Live Chat Icon For mobile
Up arrow icon