line connector not working (?)

Hi,
When I call
bool result = this.diagram1.ActivateTool("LineLinkTool");
I am able to draw a line between two nodes. However, when I call
bool result = this.diagram1.ActivateTool("LineConnectorTool");
I cannot draw a line. What do I need to do differently?

My ultimate goal is I want to know the nodes at either end of the line. The toNode and fromNode properties of the Line I get using the LineLinkTool are null and I am hoping LineConnectorTool will tell me these. Failing this, how can I find which nodes are at the to and from ends of a line?

Thanks,
Andrew

1 Reply

MF Meera Fathima Syncfusion Team July 12, 2007 07:17 AM UTC


Hello Andrew,

My apololies for the delay in responding.

Regarding your query, LineConnectorTool is the LineLinkTool. I mean the LineConnectorTool is named as LineLinkTool. And while activating a tool you should specify the correct tool name.

And if your intention is to get to know the Form Node and To Node of a connector while it is being drawn between two nodes you can use ConnectorBase.FromNode/ToNode properties within the Model.EventSink.ConnectionsChanged event.

Below is the sample code snippet for your reference.

this.diagram1.Model.EventSink.ConnectionsChanged += new CollectionExEventHandler(EventSink_ConnectionsChanged);


void EventSink_ConnectionsChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
if (evtArgs.Element is HeadEndPoint)
{
HeadEndPoint headpt = evtArgs.Element as HeadEndPoint;
if (headpt.Container is LineConnector)
{
LineConnector line = headpt.Container as LineConnector;
MessageBox.Show(line.ToNode.ToString(),"To Node");
}
}
else if (evtArgs.Element is TailEndPoint)
{
TailEndPoint tailpt = evtArgs.Element as TailEndPoint;
if (tailpt.Container is LineConnector)
{
LineConnector line = tailpt.Container as LineConnector;
MessageBox.Show(line.FromNode.ToString(),"From Node");
}
}
}

}

Please look into the above details and let me know if you have any more questions regarding this.

Thanks for your interest in Essential Diagram.

Best Regards,
Meera.

Syncfusion, Inc.
http://www.syncfusion.com/


Loader.
Up arrow icon