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

Zoom to Fit

Is there an easy way to add a zoom to fit feature that would fit the diagram into the control bounds?

2 Replies

AD Administrator Syncfusion Team July 26, 2005 02:29 PM

Hi Jeff, You can use the Diagram.View.Magnification property to set a magnification ratio that scales the diagram to fit the control bounds. The scale ratio can be estimated as follows, Size scaleratio = new Size((int)((this.diagramComponent.View.Width/this.diagramComponent.Model.Bounds.Width)*100), (int)((this.diagramComponent.View.Height/this.diagramComponent.Model.Height)*100)); this.diagramComponent.View.Magnification = scaleratio; this.diagramComponent.View.Origin = new PointF(0,0); this.diagramComponent.View.Update(true); Regards, Prakash Surendra Syncfusion Inc.,


JF Jeff Fansler July 28, 2005 10:43 AM

Hi Prakash, This worked great. Thanks. -Jeff >Hi Jeff, > >You can use the Diagram.View.Magnification property to set a magnification ratio that scales the diagram to fit the control bounds. The scale ratio can be estimated as follows, > >Size scaleratio = new Size((int)((this.diagramComponent.View.Width/this.diagramComponent.Model.Bounds.Width)*100), (int)((this.diagramComponent.View.Height/this.diagramComponent.Model.Height)*100)); > >this.diagramComponent.View.Magnification = scaleratio; >this.diagramComponent.View.Origin = new PointF(0,0); >this.diagramComponent.View.Update(true); > >Regards, >Prakash Surendra >Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon