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

Insert LineSegments from code

Hi

I link 2 symbols by OrthogonalConnector but it wasn`t look to good. How can I add more LineSegments to link?


3 Replies

AD Administrator Syncfusion Team December 10, 2008 06:17 AM UTC

Hi Andrzej,

The AddPoint() method can be used to define points in the path for the connector.

For example, the following code snippet does this,

*******

OrthogonalConnector o = new OrthogonalConnector(new PointF(0,0), new PointF(50, 50));
o.AddPoint(new PointF(50, 100));

*******

The above code produces the Orthogonal connector of shape |_
|

Let me know if you shall need any further clarifications in this regard, Thanks!

Happy coding!

- Ajeet




AP Andrzej Pienkosz December 10, 2008 03:28 PM UTC

Hi

I still have problems. This is my code:
OrthogonalConnector o = new OrthogonalConnector(new PointF(0,0), new PointF(100,100));

o.HeadDecorator.DecoratorShape = DecoratorShape.FilledFancyArrow;
o.HeadDecorator.FillStyle.Color = Color.LightSkyBlue;
o.HeadDecorator.Size = new SizeF(10, 10);
o.EnableCentralPort = true;
model.AppendChild(o);
child1.CentralPort.TryConnect(spline.TailEndPoint);
child2.CentralPort.TryConnect(spline.HeadEndPoint);

-------------------------

I get connector with shape |_

I was trying use AddPoint to get something like -|_ but it doesn`t work :(

How to do it?

Andrzej




AD Administrator Syncfusion Team December 11, 2008 03:58 AM UTC

Hi Andrzej,

As mentioned in my previous post, you need to use the "AddPoint()" method to define the points in the "path" of the connector.

Also, care must be taken that the path is directional in "Perpendicular" respect, so every "next" point defined in the path should have atleast any one match in the value of "X" or "Y".

Thus, for you requirement, the following codes draws a connector of your desired shape. The code snippet is as follows:

***********

OrthogonalConnector o = new OrthogonalConnector(new PointF(0, 0), new PointF(50, 0));
o.AddPoint(new PointF(50, 100));
o.AddPoint(new PointF(100, 100));

***********

Please note here the way the path is defined. It draws in the following order:
1. From (0,0) to (50,0)
2. From (50,0) to (50,100)
3. From (50,100) to (100,100)

Thus, this gives you the desired shape of an flipped "S".

Let me know if you shall need any further clarifications in this regard.

Happy Coding!

- Ajeet


Loader.
Live Chat Icon For mobile
Up arrow icon