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 to fit in diagram view

Thread ID:





79240 Jan 26,2009 08:16 PM UTC Feb 5,2009 09:56 AM UTC WinForms 4
Tags: Diagram
Lotfi Belattar
Asked On January 26, 2009 08:16 PM UTC


I'm trying to add a Zoom to fit feature to my diagram control view.

I tried this:
It did not work.
Is there an easy way to do it ?


Ajeet M [Syncfusion]
Replied On January 27, 2009 07:40 AM UTC

Hi Lofti,

You can use the following code snippet:


Let me know if this helps.

Happy Coding!
- Ajeet

Lotfi Belattar
Replied On January 27, 2009 10:36 PM UTC

Thank's Ajeet! That works!

Lotfi Belattar
Replied On February 4, 2009 11:07 PM UTC

Hello Ajeet,

I need to remove the size to content (this.diagram1.Model.SizeToContent = false) in my application in order to create a diagram without bounding for my nodes.
By doing this, the FitDocument (this.diagram1.FitDocument() )is not working properly.
Is there another way to fit my nodes in my view ?


Ajeet M [Syncfusion]
Replied On February 5, 2009 09:56 AM UTC

Hi Lotfi,

The FitToDocument() is used to fit the entire diagram to your view area.

The SizeToContent = true keeps the bounds flexible, ensuring that all the nodes on the model are accommodated easily.

When the SizeToContent = false, is set, it becomes our responsibility to ensure that all the nodes are inside the bounds of the model.

Thus, I would suggest you to manually set the model's logical size to a size you feel, will accommodate all the nodes perfectly.

Let me know if you shall need any further clarifications in this regard.

Happy Coding!
- Ajeet


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

or the page will be automatically redirected to 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