Articles in this section
Category / Section

How to Increase Winforms Diagram Page size?

2 mins read

In our WinForms Diagram control, you can increase the diagram page size when dragging nodes beyond the diagram page border by using the PinPointChanged event. In this event, you can update the diagram model’s DocumentSize based on the node’s bounds to ensure that the page size expands as needed. We have provided the code snippet to achieve this.

Code Snippet:

(diagram1.Model.EventSink).PinPointChanged += Form1_PinPointChanged;


private void Form1_PinPointChanged(PinPointChangedEventArgs evtArgs)
{
   var currentWidth = diagram1.Model.DocumentSize.Width;
   var currentHeight = diagram1.Model.DocumentSize.Height;
   var nodeRight = (evtArgs.NodeAffected as Node).BoundingRectangle.Right;
   var nodeBottom = (evtArgs.NodeAffected as Node).BoundingRectangle.Bottom;
   diagram1.Model.DocumentSize = new PageSize(Math.Max(currentWidth, nodeRight), Math.Max(currentHeight, nodeBottom));
} 

Conclusion:

I hope you enjoyed learning about how to increase Winforms Diagram Page when dragging nodes beyond Page.

You can refer to our WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation. You can also explore our WinForms Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied