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

View Area Resize fo fit new document size.

Thread ID:





101083 Sep 24,2011 09:01 PM UTC Sep 26,2011 10:39 AM UTC ASP.NET Web Forms (Classic) 1
Tags: DiagramWebControl
John McAteer
Asked On September 24, 2011 09:01 PM UTC


After changing the document size I would like the view area to adjust to fit the document.

However my view area always remains too big when the document size is reduced so I have to scroll back to the left to see my new document.

I have tried

1. .View.FitDocument();
2. .View.ScrollVirtualBounds=new RectangleF(0, 0, docW, docH);

Nothing works so far.

Any ideas?


Amsath Ali M [Syncfusion]
Replied On September 26, 2011 10:39 AM UTC

Hi John,

Thanks for using Syncfusion products.

We suggest you to use the Diagram’s ‘SizeChanged’ event, ‘FitDocument’ method and Diagram.View’s ‘ScrollVitualBounds’ method to achieve your requirement. Please refer the below code.

Here is the code snippet:
//Size Changed event
diagram1.SizeChanged += new EventHandler(diagram1_SizeChanged);

void diagram1_SizeChanged(object sender, EventArgs e)
//Fit the document on control field.
this.diagram1.View.ScrollVirtualBounds = new RectangleF(0,0,0,0);


For your convenience, we have created a simple sample to achieve your requirement.
Please try the below sample and let us know if you have any queries.
Forum DiagramFitDocument-806842262.zip

Amsath Ali. M


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