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.
Unfortunately, activation email could not send to your email. Please try again.

ZoomToFit Programaticly

Thread ID:

Created:

Updated:

Platform:

Replies:

81066 May 11,2009 11:39 AM May 14,2009 09:58 AM Windows Forms 3
loading
Tags: Diagram
Lotfi Belattar
Asked On May 11, 2009 11:39 AM

Hello,

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().

Regards.
Lotfi

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

Hi Lotfi,

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


http://files.syncfusion.com/support/Diagram.Windows/Forums/F81066/main.htm

Thanks & Regards,
Gowri

Lotfi Belattar
Replied On May 12, 2009 11:19 AM

HiGowri,

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);
this.diagram1.FitDocument();
this.diagram1.UpdateView();
}

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 ?

Regards,
Lotfi

Administrator [Syncfusion]
Replied On May 14, 2009 09:58 AM

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.


Regards,
Gowri

CONFIRMATION

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.

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.

;