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.

Centering HeadingHead/HeadingTail

Thread ID:

Created:

Updated:

Platform:

Replies:

70634 Dec 20,2007 12:29 PM Jan 21,2008 04:43 PM Windows Forms 3
loading
Tags: Diagram
Michael M.
Asked On December 20, 2007 12:29 PM

Hallo
is there any possibility to connect two nodes and the links starts and ends at a nodes centre point.

HeadingHead and Tail does not support this.

Is there another way.

Regards Michi


Sri Rajan [Syncfusion]
Replied On December 20, 2007 06:37 PM



Hi Michi,

To connect two nodes and the links starts and ends at a nodes centre point, Please try the following code.

[C#]

Rectangle m_rect1 = new Rectangle(50, 50, 120, 60);
this.diagram1.Model.AppendChild(m_rect1);

Rectangle m_rect2 = new Rectangle(250, 250, 50, 50);
this.diagram1.Model.AppendChild(m_rect2);

LineConnector line = new LineConnector(m_rect1.PinPoint, m_rect2.PinPoint);
this.diagram1.Model.AppendChild(line);
m_rect1.CentralPort.TryConnect(line.HeadEndPoint);
m_rect2.CentralPort.TryConnect(line.TailEndPoint);

If you are using node object then please set EnableCenterPort property of the node to true. So that you can connect the nodes by a link.

Regards,
Srirajan


Michael M.
Replied On January 16, 2008 09:07 AM

Hallo
thanks for your quick answer. But i still can't achieve my goal with your information. If i connect to shapes (enablecenterpoint is set to true, and pinpoint of the shapes is set to the centerpoint of the object) with their centerpoints the link always ends at the border of the shape. If i move the shape the head and tail point from the link was changed, but still ends at the borderline.

Kind regards
Michi



centerLink.zip

Sri Rajan [Syncfusion]
Replied On January 21, 2008 04:43 PM

Hi Michi,

Please try the below code to connect two nodes and the links starts and ends at a nodes centre point,

[C#]

Syncfusion.Windows.Forms.Diagram.Rectangle fromNode = new Syncfusion.Windows.Forms.Diagram.Rectangle(50, 50, 100, 100);
this.diagram1.Model.AppendChild(fromNode);

ConnectionPoint point1 = new ConnectionPoint(fromNode, PortVisuals.CirclePort);
point1.OffsetX = 50;
point1.OffsetY = 50;
fromNode.Ports.Add(point1);

Syncfusion.Windows.Forms.Diagram.Rectangle toNode = new Syncfusion.Windows.Forms.Diagram.Rectangle(200, 200, 100, 100);

ConnectionPoint point = new ConnectionPoint(toNode, PortVisuals.CirclePort);
point.OffsetX = 50;
point.OffsetY = 50;
toNode.Ports.Add(point);

this.diagram1.Model.AppendChild(toNode);

LineConnector connector = new LineConnector(PointF.Empty, new PointF(20, 20));

connector = new LineConnector(PointF.Empty, new PointF(50, 50));

connector.HeadDecorator.DecoratorShape = DecoratorShape.FilledFancyArrow;
connector.HeadDecorator.Size = new SizeF(10, 10);
connector.HeadDecorator.FillStyle.Color = Color.YellowGreen;

this.diagram1.Model.AppendChild(connector);

fromNode.Ports[1].TryConnect(connector.HeadEndPoint);
toNode.Ports[1].TryConnect(connector.TailEndPoint);


Please refer the below sample for more details.

http://websamples.syncfusion.com/samples/Diagram.Windows/F70634/main.htm

Please let me know if you have any other questions.

Regards,
Srirajan



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.

;