Customize and invoke the line connector behavior

Applies to: Nevron Diagram for .NET

How to customize and invoke the line connector behavior?

You can customize and invoke (for example from a custom toolbar) the the line connector behavior found behind the default toolbar. You can click on tool button - select shape1.port1 navigate to shape 2 with the line showing, then click shape2.port2 and the line becomes fixed. The Connector Tool can easily be enabled with the following code:

[C#]
nDrawingView1.Controller.Tools.SingleEnableTool(NDWFR.ToolCreateConnector);

[VB.NET]
nDrawingView1.Controller.Tools.SingleEnableTool(NDWFR.ToolCreateConnector)

This line of code enables the tool for (the exact same thing is performed by the toolbar button). The NCreateConnectorTool has a ConnectorType property, which specifies the type of connector to create:

[C#]
NCreateConnectorTool  tool = nDrawingView1.Controller.Tools.GetToolByName(NDWFR.ToolCreateConnector) as NCreateConnectorTool;
tool.ConnectorType = ConnectorType.Line;

[VB.NET]
Dim tool As NCreateConnectorTool = TryCast(nDrawingView1.Controller.Tools.GetToolByName(NDWFR.ToolCreateConnector), NCreateConnectorTool)
tool.ConnectorType = ConnectorType.Line

The code above shows how to switch to a line connector.

You can also programmatically link shapes with a line. Take a look at the following topic:
Nevron Diagram >> User’s Guide >> Document Object Model >> Models >> Shapes >> look at the Shape Plugs section

Article ID: 46, Created On: 10/5/2010, Modified: 12/29/2010