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. Image for the cookie policy date

ControlNode and Document size

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


1 Reply

BM Bala Murugan A.S Syncfusion Team 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


Loader.
Live Chat Icon For mobile
Up arrow icon