We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

diagram lineconnector question

Has anyone figured out how to create a lineconnector whose path can be controlled by adjusting control points which force the connector to follow a bezier curved path?


9 Replies

SK Senthil Kumar M Syncfusion Team April 12, 2012 06:03 AM UTC

Hi Jan Stiff,

Thanks for using Syncfusion products.

Diagram control has BezierCurve which act as a connector. We suggest you to use BezierCurve for your requirement.
Please refer the below code snippet:

[C#]

//Create a node
Ellipse ellipse1 = new Ellipse(0, 50, 100, 50);
Ellipse ellipse2 = new Ellipse(250, 50, 100, 50);

// Add node to diagram control
diagram1.Model.AppendChild(ellipse1);
diagram1.Model.AppendChild(ellipse2);

//Create a bezierCurve
BezierCurve bezierCurve = new BezierCurve(new PointF[] { new PointF(0, 60), new PointF(28, 6), new PointF(72, 0), new PointF(100, 60), new PointF(124, 6), new PointF(144, 0), new PointF(200, 60), new PointF(248, 6), new PointF(288, 0), new PointF(320, 60) });
diagram1.Model.AppendChild(bezierCurve);

//Connect a Nodes.
ellipse1.CentralPort.TryConnect(bezierCurve.TailEndPoint);
ellipse2.CentralPort.TryConnect(bezierCurve.HeadEndPoint);


You can draw BezierCurve by activating the BezierTool .
Please refer the below code snippet :

[C#]
//To activate a BezierTool
diagram1.Controller.ActivateTool("BezierTool");


Here is the sample, for your reference.
http://www.syncfusion.com/downloads/Support/DirectTrac/92627/103178Sample612108459.zip

Please let me know, if any concerns

Regards,

Senthilkumar.M




AD Administrator Syncfusion Team April 12, 2012 09:46 AM UTC

Is there anyway to provide the user the ability to alter where the control points are so that he can change the path of the link as needed at runtime?



AD Administrator Syncfusion Team April 12, 2012 09:52 AM UTC

Also, is there a way to enable line-bridging, etc. such as with other types of connectors?



AD Administrator Syncfusion Team April 12, 2012 10:25 AM UTC

Sorry for the disjointed updates. I'm trying to do this while taking care of other things.

Is there a way to motivate Syncfusion to produce complete documentation sets? I am using version 8.2.0.18 which supports the BezierCurve, but it is not mentioned anywhere in the documentation for the libraries which are supplied with this version. This lack of documentation makes it very difficult to use the libraries effectively. Has anyone else had this problem?




SK Senthil Kumar M Syncfusion Team April 17, 2012 04:34 AM UTC

Hi Jan Stiff,

Thanks for the update.

1.You can get the controls points handle of Node by setting the DefaultHandleEditMode property of Node to Vertex. So that you can change the control points at run time.
Please refer the below code snippet :


[C#]

//Create a BezierCurve
BezierCurve bezierCurve = new BezierCurve(new PointF[] { new PointF(0, 60), new PointF(28, 6), new PointF(72, 0), new PointF(100, 60), new PointF(124, 6), new PointF(144, 0), new PointF(200, 60), new PointF(248, 6), new PointF(288, 0), new PointF(320, 60) });
diagram1.Model.AppendChild(bezierCurve);
bezierCurve.EditStyle.DefaultHandleEditMode = HandleEditMode.Vertex;




2. Diagram control supports line-bridging. You can use LineBridgingEnabled property of diagram control for your requirement.
You can also change the line-bridging size by using the LineBridgingSize property of diagram control.
You can also change the style of line bridging by using the BridgeStyle property of diagram control.

Please refer the below code snippet :


[C#]
//Enable LineBridging in diagram.
diagram1.Model.LineBridgingEnabled = true;
//Change the LineBridging size.
diagram1.Model.LineBridgeSize = 20;
//Change the LineBridging style.
diagram1.Model.BridgeStyle = BridgeStyle.Square;



Please refer the UG link for more details.
http://help.syncfusion.com/Ug_101/User%20Interface/Windows%20Forms/Diagram/default.htm#!Documents/421linebridging.htm

3. We regret to inform you that documentation does not have details about BezierCurve. We will improve our document in future.
Here is the UG link for more details in the documentation.
http://help.syncfusion.com/resources/Ug_101/User%20Interface/Windows%20Forms/Diagram

Here is the sample, for your reference.
http://www.syncfusion.com/downloads/Support/DirectTrac/92627/103178Sample-1903436163.zip

Please let me know,if any concerns

Regards,

Senthilkumar.M





AD Administrator Syncfusion Team April 17, 2012 07:12 AM UTC

Thank you. Your response for implementing the control points works, but you example for implementing the line bridging does not.I have no idea why, but I guess I will just have to live with it. Line bridging works for LineConnector and PolylineConnector. So maybe I am just stuck using them.



AA Amsath Ali M Syncfusion Team April 24, 2012 07:41 PM UTC

Hi Jan,

Thanks for the update.

We are happy to hear that the issue has been resolved by yourself.
Please let us know if you further assistance on this. We would be happy to help you out.

Regards,
Amsath Ali. M





AD Administrator Syncfusion Team April 30, 2012 08:12 AM UTC

Thank you for the response. If anyone ever figures out how to get the line bridging to work with the bezier curves, hopefully they will update this thread.



AA Amsath Ali M Syncfusion Team May 3, 2012 12:59 PM UTC

Hi Jan,

Thanks for your update.

Currently we don’t have an option for adding LineBridges to Bezier curves. For this, please create a DT incident for your query so that we can update the patch for this feature.

You can create the DT incident from the following link.
<http://www.syncfusion.com/account/dashboard>

In the interests of maintaining confidentiality, we have a policy of not sharing patches or otherwise proprietary customer specific information in the public Forum.

Please let us know if you have any queries.

Regards,
Amsath Ali. M





Loader.
Live Chat Icon For mobile
Up arrow icon