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

Addint and removing ports on bounds change

Hi I have a long line symbol running across the doagram whose ports to be added acording to its width when resized. I am using the following code in bounds changed event.... protected override void OnBoundsChanged(BoundsEventArgs evtArgs) { for(int j = this.Ports.Count ; j>0; j--) { this.Ports.Remove(this.Ports[j-1]); } for(int i = 0;i
2 Replies

MF Meera Fathima Syncfusion Team October 20, 2005 05:35 AM UTC

Hi Sachin, As per my update on the Direc Trac incident #21544, I will try to come up with a solution as soon as possible. And to draw the Start Cap/End Cap for a line, you can use the Line class FirstEndPointDecorator/LastEndPointDecorator properties. My apologies for the delay. Thanks for your support to Syncfusion. Regards, Meera.


MF Meera Fathima Syncfusion Team October 26, 2005 11:43 AM UTC

Hi Sachin, I am sorry about this delay in getting back to you on this issue.The LineStyle class has only the EndCap property and StartCap property was leftout.A QA report regarding this issue has been logged, and we will fix the issue in a future release of the product. The incident id is #954. You can see the report details using our web based tracking system. The workaround for adding the StartCap would be to subclass the Line class, override the Line.Draw(...) method and add the start cap to the Pen after it gets created. Referring the Line.cs file will help you to work with this. As for adding the new ports, it is necessary to get hold of the symbol''s transformation matrix, and apply an inverse transform on the point to be used for the port.The following revised implementation of your OnBoundsChanged() method shows how to go about it, protected override void OnBoundsChanged(BoundsEventArgs evtArgs) { base.OnBoundsChanged (evtArgs); for(int j = this.Ports.Count ; j>0; j--) { this.Ports.Remove(this.Ports[j-1]); } float xoffset = this.X; while(xoffset < (this.X + this.Width)) { PointF ptworld = new PointF(xoffset, this.Location.Y + this.Height / 2); PointF[] pts = new PointF[] {ptworld}; Matrix worldxform = this.WorldTransform; worldxform.Invert(); worldxform.TransformPoints(pts); CirclePort cPort = new CirclePort(pts[0]); this.Ports.Add(cPort); xoffset += 10f; } } I hope the above information will help you. Please let me know if you need further assistance on this issue. Thanks for your patience and support. Regards, Meera.

Loader.
Live Chat Icon For mobile
Up arrow icon