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 07:29 PM UTC

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 03:43 PM UTC

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.
Up arrow icon