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.

Get Diagram actual size

Thread ID:

Created:

Updated:

Platform:

Replies:

119211 May 22,2015 06:09 AM May 25,2015 05:12 AM Windows Forms 1
loading
Tags: Diagram
Ivan
Asked On May 22, 2015 06:09 AM

Hi,
how can I get the actual size of my diagram?

For example:
rect = new Rectantle(0,0,20,20);

I want to get the size of the diagram, so, width = 20, height = 20.
If I have:
rect1 = new Rectantle(0,0,20,20);
rect 2= new Rectantle(20,0,20,20);
I'll have width = 40, height = 20.

This is a very simple sample; I should know the size of a DirectedTreeLayout with lots of nodes and levels.

Thank you,
Ivan

Swarnesh Krishna Kumar [Syncfusion]
Replied On May 25, 2015 05:12 AM

Hi Ivan,
Thanks for using Syncfusion products.
We are glad to inform that we have created a simple sample to achieve your requirement.


how can I get the actual size of my diagram?

For example:

rect = new Rectantle(0,0,20,20);


I want to get the size of the diagram, so, width = 20, height = 20.

If I have:

rect1 = new Rectantle(0,0,20,20);

rect 2= new Rectantle(20,0,20,20);

I'll have width = 40, height = 20.


This is a very simple sample;


We suggest you to get the size of the diagram by

Diagram.Model.LogicalSize.Width and Diagram.Model.LogicalSize.Height.


Here is the code snippet:


[C#]

//Finding the size of the diagram

SizeF DiagramSize = new SizeF(diagram1.Model.LogicalSize.Width, diagram1.Model.LogicalSize.Height);

I should know the size of a DirectedTreeLayout with lots of nodes and levels.

We suggest you to get the size of the layout by passing the Layoutmanager.Model.Nodes and the MeasureUnit in Diagram.Controller.GetBoundingRect property.

Here is the code snippet:


[C#]

DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager(this.diagram1.Model, 0, 50, 60);

RectangleF Rect = new RectangleF();

//Finding the size of the layout Rect=this.diagram1.Controller.GetBoundingRect(dtlm.Model.Nodes, MeasureUnits.Pixel);

SizeF LayoutSize = new SizeF(Rect.Width, Rect.Height);


Here is the Sample:

Sample




Please let us know if any concerns.
Regards,
Swarnesh K

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.

;