Centering HeadingHead/HeadingTail
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
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
SIGN IN To post a reply.
3 Replies
SR
Sri Rajan
Syncfusion Team
December 20, 2007 11:37 PM UTC
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
MM
Michael M.
January 16, 2008 02:07 PM UTC
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
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
SR
Sri Rajan
Syncfusion Team
January 21, 2008 09:43 PM UTC
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
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MM Michael M.
- Dec 20, 2007 05:29 PM UTC
- Jan 21, 2008 09:43 PM UTC