How to create multiple connection points for a node in WinForms Diagram?
In our WinForms Diagram control, you can create multiple connection points for a Node by assigning different offsets to each ConnectionPoint. Offsets determine the position of the connection points relative to the node’s boundaries, allowing you to place them in various locations. We have provided a code snippet to demonstrate how to achieve this.
//Code for creating a Rectangle
Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 100, 100, 50);
//Code for creating a ConnectionPoint
Syncfusion.Windows.Forms.Diagram.ConnectionPoint cp = new Syncfusion.Windows.Forms.Diagram.ConnectionPoint();
cp.OffsetX = 0;
cp.OffsetY = 25;
cp.FillStyle.Color = Color.Red;
rect.Ports.Add(cp);
Syncfusion.Windows.Forms.Diagram.ConnectionPoint cp1 = new Syncfusion.Windows.Forms.Diagram.ConnectionPoint();
cp1.OffsetX = 0;
cp1.OffsetY = 50;
cp1.FillStyle.Color = Color.Red;
rect.Ports.Add(cp1);
Syncfusion.Windows.Forms.Diagram.ConnectionPoint cp2 = new Syncfusion.Windows.Forms.Diagram.ConnectionPoint();
cp2.OffsetX = 0;
cp2.OffsetY = 75;
cp2.FillStyle.Color = Color.Red;
rect.Ports.Add(cp2);
Conclusion:
I hope you enjoyed learning about how to create multiple connection points for a node in WinForms Diagram
You can refer to our WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!