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.
Unfortunately, activation email could not send to your email. Please try again.

Programmatically adding links

Thread ID:

Created:

Updated:

Platform:

Replies:

15580 Jun 22,2004 09:57 PM Jun 25,2004 07:58 AM Windows Forms 2
loading
Tags: Diagram
Rich
Asked On June 22, 2004 09:57 PM

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?

Rich
Replied On June 22, 2004 09:59 PM

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 07:58 AM

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.

CONFIRMATION

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.

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.

;