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. Image for the cookie policy date

How do i implement middle arrow to the link

Hi does anyone success on implement middle arrow into the link ?

3 Replies

AD Administrator Syncfusion Team January 11, 2005 04:19 PM

Hi Suwit, I am assuming you are referring to creating a custom Link type. To customize the Link drawing, implement a subclass of the Syncfusion.Windows.Forms.Diagram.Link class with an appropriate override of the Link.CreateLinkShape(Link.Shapes shapeType, PointF[] pts) method that renders the link. A sample override is shown below, // Override the Link.CreateLinkShape method in a Link subclass protected override IPoints CreateLinkShape(Link.Shapes shapeType, PointF[] pts) { Shape linkShape = null; if(shapeType == Link.Shapes.Arc) { OrthogonalLine orthogonalLine = new OrthogonalLine(); orthogonalLine.AutomaticHeadings = true; linkShape = orthogonalLine; } if(linkShape != null) { linkShape.SetPoints(pts); } return linkShape; } Now to use your Link class all that is required is to provide a suitable LinkFactory delegate to the LinkTool that create the Link type that you have defined. A sample implementation as used in the DiagramBuilder sample is shown below, // Create and register a tool for arc links LinkTool arcLinkTool = new LinkTool("ArcLinkTool"); arcLinkTool.LinkFactory = new LinkFactory(this.CreateArcLink); this.diagram.Controller.RegisterTool(arcLinkTool); // Implement the LinkFactory delegate protected Link CreateArcLink(PointF[] pts) { Link link = new Link(Link.Shapes.Arc, pts); return link; } I hope this helps. Regards, Prakash


SU suwit January 12, 2005 09:40 AM

Thanks, but??? where is middle arrow in the code? >Hi Suwit, > >I am assuming you are referring to creating a custom Link type. To customize the Link drawing, implement a subclass of the Syncfusion.Windows.Forms.Diagram.Link class with an appropriate override of the Link.CreateLinkShape(Link.Shapes shapeType, PointF[] pts) method that renders the link. A sample override is shown below, > >// Override the Link.CreateLinkShape method in a Link subclass >protected override IPoints CreateLinkShape(Link.Shapes shapeType, PointF[] pts) >{ > Shape linkShape = null; > if(shapeType == Link.Shapes.Arc) > { > OrthogonalLine orthogonalLine = new OrthogonalLine(); > orthogonalLine.AutomaticHeadings = true; > linkShape = orthogonalLine; > } > > if(linkShape != null) > { > linkShape.SetPoints(pts); > } > > return linkShape; >} > >Now to use your Link class all that is required is to provide a suitable LinkFactory delegate to the LinkTool that create the Link type that you have defined. A sample implementation as used in the DiagramBuilder sample is shown below, > >// Create and register a tool for arc links >LinkTool arcLinkTool = new LinkTool("ArcLinkTool"); >arcLinkTool.LinkFactory = new LinkFactory(this.CreateArcLink); >this.diagram.Controller.RegisterTool(arcLinkTool); > >// Implement the LinkFactory delegate >protected Link CreateArcLink(PointF[] pts) >{ > Link link = new Link(Link.Shapes.Arc, pts); > return link; >} > >I hope this helps. > >Regards, >Prakash


AD Administrator Syncfusion Team January 12, 2005 12:29 PM

Suwit, That bit of code was provided just to help you get started with the implementation for custom drawing the ''link middle arrow''. In your custom Link class''s override of the CreateLinkShape() method, you will have to interpret the PointF collection and draw the link(with the middle arrow) as required. Unfortunately, we do not have any code available that shows rendering a Link with such a middle arrow. Thanks, Prakash Surendra

Loader.
Live Chat Icon For mobile
Up arrow icon