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
close icon

View Area Resize fo fit new document size.

Hi

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?

Thanks
John



1 Reply

AA Amsath Ali M Syncfusion Team 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:
[C#]
//Size Changed event
diagram1.SizeChanged += new EventHandler(diagram1_SizeChanged);


void diagram1_SizeChanged(object sender, EventArgs e)
{
//Fit the document on control field.
diagram1.FitDocument();
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

Regards,
Amsath Ali. M



Loader.
Live Chat Icon For mobile
Up arrow icon