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

ZoomToFit Programaticly

Thread ID:





81066 May 11,2009 03:39 PM UTC May 14,2009 01:58 PM UTC WinForms 3
Tags: Diagram
Lotfi Belattar
Asked On May 11, 2009 03:39 PM UTC


I have a diagram with Model.SizeToContent set to false.
I need to zoom my view to fit my model.

How can I do that without putting my Model.SizeToContent to true and calling diagram.FitDocument().


Administrator [Syncfusion]
Replied On May 12, 2009 09:07 AM UTC

Hi Lotfi,

I have created the sample for your requirement.Here i have mentioned link for the sample.Please check it.


Thanks & Regards,

Lotfi Belattar
Replied On May 12, 2009 03:19 PM UTC


I have modified your sample in order to be able to move items outside the view:
this.model1.BoundaryConstraintsEnabled = false;

And I also added the FitToDocument() in your function:

private void btnZoom_Click(object sender, EventArgs e)
RectangleF rectF = new RectangleF();
foreach (Node nd in this.diagram1.Model.Nodes)
rectF = RectangleF.Union(rectF, nd.BoundingRectangle);
this.diagram1.Model.LogicalSize = new SizeF(rectF.Right, rectF.Bottom);

Now, If I move an Item on the left or up outside the view, the FitDocument does not work.
Is there a parameter that I have to set in order to fix that ?


Administrator [Syncfusion]
Replied On May 14, 2009 01:58 PM UTC

Hi Lotif,

Thanks for your update.

We have updated the response for your incident(55811) the same issue which you have mentioned in this forum.Let me know your problem getting solved.



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