Essential Diagram ASP.NET
View Area Resize fo fit new document size.
September 26, 2011 06:39 AM by Amsath Ali M[Syncfusion]
John McAteer
View Area Resize fo fit new document size.
September 24, 2011 05:01 PM
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


Amsath Ali M
[Syncfusion]
View Area Resize fo fit new document size.
September 26, 2011 06:39 AM
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


::adCenter::