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)
rect[intRow] = new Syncfusion.Windows.Forms.Diagram.Rectangle(intOffsetX,intOffsetY,80,30);
sym[intRow] = new Symbol();
sym[intRow].Name = "Node_" + intRow.toString();
Syncfusion.Windows.Forms.Diagram.Label lbl = sym[intRow].AddLabel("Some text", BoxPosition.Center);
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);
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?
please ignore the switch statement in my example, i chopped my code down and forgot to remove it
ADAdministrator Syncfusion Team June 25, 2004 06:58 AM
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.