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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Zoom the rectangle to the Diagram Control Dimensions without loosing the Aspect Ratio

Thread ID:





81305 May 19,2009 05:34 AM UTC May 21,2009 06:54 AM UTC WinForms 3
Tags: Diagram
Murali Krishna
Asked On May 19, 2009 05:34 AM UTC


I have a rectangle with some predefine width and height.

I need to draw the rectangle in such a way that it occupies the entire viewable are of the diagram control. In other words it shoulb be zoomed in maintaining the aspect ratio.

For e.g., if the rectangle width is 100 and height is 100.
Let the diagram control width is 500 and height is also 500.

Now my rectangle should occupy the entire width and height of the diagram control.

I cant directly set the height and width of the rectangle to diagram dimensions as there are numerous calculations are based on the rectangle dimensions.

In a simplified way my requirement is to zoom the rectangle to the diagram control dimensions without loosing the aspect ratio.

Please let me know the solution for this ASAP.

Thanks In advance,

Gowri Manohari D [Syncfusion]
Replied On May 20, 2009 12:51 PM UTC

Hi Murali,

Thanks for choosing Syncfusion Products.

The below is the code snippet for your requirement.Let me know it will meet your requirement.

Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(50, 50,100, 100);
rect.NodeScale.Width = diagram1.Width;

Thanks & Regards,

Murali Krishna
Replied On May 20, 2009 12:57 PM UTC


The NodeScale.Width is not accessable due to its Protection level.
Do I need to include something?
My version of SyncFusion is


Administrator [Syncfusion]
Replied On May 21, 2009 06:54 AM UTC

Hi Murali,

The below is the code snippet for your version.

Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(50, 50, 100, 100);
rect.NodeScale.ModelScale = diagram1.Width;

Let me know any future reference in this regard.

Thanks & Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon