Selecing LineConnector

I have created a simple diagram based on your InteractDiagram example.
I would like to be able to select a line connector and delete it.
I would also like to be able to change the node to which a line is connected.
Can you tell me how I can do this?

3 Replies

MF Meera Fathima Syncfusion Team May 16, 2007 06:48 AM UTC


Hi Phil Curtis,

Sorry about this delay in responding to your query.

Please refer the ScriptyClient sample which demonstrates how to add/delete nodes, draw links between two nodes that are in the selection list.

Following is the sample code snippet from the ScriptyClient sample for your reference :

// To delete the node.
protected void Remove_Click(object sender, System.EventArgs e)
{
if (this.DiagramWebControl1.View.SelectionList.Count > 0)
{
foreach (Node nodeTemp in DiagramWebControl1.View.SelectionList)
{
DiagramWebControl1.Model.RemoveChild(nodeTemp);
}
this.DiagramWebControl1.View.SelectionList.Clear();
}
}

// To draw line connector between two nodes.

protected void Link_Click(object sender, System.EventArgs e)
{
if (this.DiagramWebControl1.View.SelectionList.Count == 2)
{
Node node1 = (Node)this.DiagramWebControl1.View.SelectionList[0];
Node node2 = (Node)this.DiagramWebControl1.View.SelectionList[1];

node1.EnableCentralPort = true;
node2.EnableCentralPort = true;

LineConnector lConn = new LineConnector(new PointF(1, 1), new PointF(2, 2));
this.DiagramWebControl1.Model.AppendChild(lConn);

EndPoint endPoint = null;

endPoint = lConn.TailEndPoint;
node1.CentralPort.TryConnect(endPoint);

endPoint = lConn.HeadEndPoint;
node2.CentralPort.TryConnect(endPoint);
}
}

I hope the above informations will help you. Please let me know if you have any more queries regarding this. We will be glad to assist you.

Thank you for using Syncfusion products.

Best Regards,
Meera.


AM amir February 10, 2018 01:12 PM UTC

ok


NG Naganathan Ganesh Babu Syncfusion Team February 12, 2018 04:06 AM UTC

Hi Amir, 
 
Thanks for the update. 
 
Please let us know whether the issue has been resolved? 
 
Regards, 
 
Naganathan K G 


Loader.
Up arrow icon