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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically adding links

Thread ID:





15580 Jun 23,2004 01:57 AM UTC Jun 25,2004 11:58 AM UTC WinForms 2
Tags: Diagram
Asked On June 23, 2004 01:57 AM UTC

Hi, I am trying to programmatically add a bunch of symbols to the diagram and link them, based on data from a dataset. I have used the following code to create the symbols. foreach(System.Data.DataRow row1 in dtInstance.Rows) { switch (row1[0].ToString().ToLower()) { rect[intRow] = new Syncfusion.Windows.Forms.Diagram.Rectangle(intOffsetX,intOffsetY,80,30); sym[intRow] = new Symbol(); sym[intRow].Name = "Node_" + intRow.toString(); sym[intRow].AppendChild(rect[intRow]); diagramComponent.Model.AppendChild(sym[intRow]); //Add Label Syncfusion.Windows.Forms.Diagram.Label lbl = sym[intRow].AddLabel("Some text", BoxPosition.Center); intRow++; } } this adds the symols just fine, and I know that the following code block, when referencing the appropriate symbols will draw the links that I am after. Link link = new Link(Link.Shapes.Line); sym[1].Connect(sym[1].CenterPort, link.TailPort); sym[2].Connect(link.HeadPort, sym[2].CenterPort); diagramComponent.Model.AppendChild(link); my problem is that when I come to draw the links, I do not know what sym[x] to reference, I only have the names given to the .Name property of the symbols. Can I programmatically refer to the symbol names, instead of their object name?

Replied On June 23, 2004 01:59 AM UTC

please ignore the switch statement in my example, i chopped my code down and forgot to remove it

Administrator [Syncfusion]
Replied On June 25, 2004 11:58 AM UTC

Hi Richard, The Diagram''s model has a Model.Nodes property that returns a INodeCollection of all nodes that are present in the model. You can use this property to implement a utility function in your application that iterates the node collection, determines whether a particular node is a Symbol type and if so retrieves it after comparing it with the provided name. Prakash Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon