How to customize connector type for drawing in WinForms Diagram?
Customize connector type
Diagram supports various types of line connector. All types can be drawn using Drawing Tool. LineBaseTool is the base class for all line connectors. The customization requires derived class from the desired LineConnector class. The CreateNode virtual method of LineBaseTool will assist you to customize the drawing LineConnector.
Refer to the following code example and sample where the Label is added for drawing LineConnector.
Code example:
// Create and assign the custom (CustomOrthogonalConnectorTool) drawing tool in diagram
CustomOrthogonalConnectorTool tool = new CustomOrthogonalConnectorTool(this.diagram1.Controller);
this.diagram1.Controller.ActivateTool(tool);
/// <summary>
/// Custom class is derived from OrgLineConnectorTool
/// </summary>
public class CustomOrthogonalConnectorTool : OrgLineConnectorTool
{
/// <summary>
/// Creates the line shape node.
/// </summary>
/// <param name="ptStart">The start point.</param>
/// <param name="ptEnd">The end point.</param>
/// <returns>The orthogonal line connector</returns>
protected override Node CreateNode(PointF ptStart, PointF ptEnd)
{
OrgLineConnector connector1 = base.CreateNode(ptStart, ptEnd) as OrgLineConnector;
// Place for customization of Connector for e.g. change the appearance and adding label.
return connector1;
} }
Conclusion
I hope you enjoyed learning about how to customize connector type for drawing in WinForms Diagram.
You can refer to our WinForms Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
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!