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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ControlNode and Document size

Thread ID:

Created:

Updated:

Platform:

Replies:

97601 Dec 15,2010 08:09 PM UTC Dec 18,2010 07:30 AM UTC WinForms 1
loading
Tags: Diagram
Marcelo de Aguiar
Asked On December 15, 2010 08:09 PM UTC

My application have a main form and some child windows, each child window have a diagram control. How to:

1. make my Model.DocumentSize fill the entire child window in a way that resizing my window will resize my Model document size.

2. I have inherited from ControlNode class and got a bunch of these nodes added to my Diagram. When my Diagram is resized I need my nodes to keep aspect ratio. Example: My node has a size of 10% of diagram size, when diagram is resized my node have to resize to keep at 10%. How to capture diagram and node resize events to update this value?

Thanks


Bala Murugan A.S [Syncfusion]
Replied On December 18, 2010 07:30 AM UTC

Hi Marcelo,

Thanks for using Syncfusion Products.

1. make my Model.DocumentSize fill the entire child window in a way that resizing my window will resize my Model document size.

For Resizing model document size according to the windows form size, we suggest to change the size of the model in form resize event. please refer the below code snippet to achieve this,

[C#]
private void Form1_Resize(object sender, EventArgs e)
{
diagram1.Model.DocumentSize = new Syncfusion.Windows.Forms.Diagram.PageSize(this.Width-10, this.Height-10); diagram1.Width = this.Width-100;
diagram1.Height = this.Height-100;
}

2. I have inherited from ControlNode class and got a bunch of these nodes added to my Diagram. When my Diagram is resized I need my nodes to keep aspect ratio. Example: My node has a size of 10% of diagram size, when diagram is resized my node have to resize to keep at 10%. How to capture diagram and node resize events to update this value?

To keep the node's size of the node when the diagram is resized, we suggest you to change the size of the node to keep the node size. Please refer the below code snippet to achieve this,

[C#]

void diagram1_SizeChanged(object sender, EventArgs e)
{
foreach (Node node in this.diagram1.Model.Nodes)
{
node.Size = new SizeF(this.diagram1.Width/10,this.diagram1.Height/10);
}
}

Please let me know if we have misunderstood your requirements

We have prepared a simple sample to demonstrate this and the same can be downloaded from the below link,

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DocumentSizeDemo-737373602.zip

Please let me know your concerns.

Regards,
Bala Murugan A.S


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.

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

;