Hi Cuongnq,
You can try setting the name property of the LineConnector after attached the LineConnector in a DIagram Model. Please refer to the following code snippet
NodeCollection coll = new NodeCollection();
for (int i = 0; i < 10; i++)
{
// Create a EmployeeSymbol for each employee in the organization and add the membersymbol to
// the diagram.
int x = 50 + i * 50;
int y = 60 + i * 100;
Rectangle m_rect1 = new Rectangle(x, y, 120, 58);
this.DiagramWebControl1.Model.AppendChild(m_rect1);
coll.Add(m_rect1);
}
for (int i = 0; i < 10; i++)
{
if (i + 1 < 10)
{
Node node1 = coll[i] as Node;
Node node2 = coll[i + 1] as Node;
LineConnector line = new LineConnector(node1.PinPoint, node2.PinPoint);
this.DiagramWebControl1.Model.AppendChild(line);
node1.CentralPort.TryConnect(line.HeadEndPoint);
node2.CentralPort.TryConnect(line.TailEndPoint);
}
}
foreach (INode node in this.DiagramWebControl1.Model.Nodes)
{
Node m_node=node as Node;
if(m_node is Rectangle)
{
m_node.Name = string.Format("Rect{0}", ++i);
Response.Write(m_node.Name);
}
if (m_node is LineConnector)
{
m_node.Name = string.Format("LineConnector{0}", ++j);
Response.Write(m_node.Name);
}
}
I have attached the sample that demonstrates this completely.
CreateNodes.zipPlease refer to the sample and let me know if you have any questions.
Best regards,
Nagaraj