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.
Unfortunately, activation email could not send to your email. Please try again.

Insert LineSegments from code

Thread ID:

Created:

Updated:

Platform:

Replies:

78338 Dec 9,2008 09:54 AM Dec 10,2008 10:58 PM Windows Forms 3
loading
Tags: Diagram
Andrzej Pienkosz
Asked On December 9, 2008 09:54 AM

Hi

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


Administrator [Syncfusion]
Replied On December 10, 2008 01:17 AM

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



Andrzej Pienkosz
Replied On December 10, 2008 10:28 AM

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



Administrator [Syncfusion]
Replied On December 10, 2008 10:58 PM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;