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

Expand and collapse controlnode

Thread ID:





105819 Nov 20,2012 02:10 PM UTC Nov 26,2012 10:57 AM UTC WinForms 1
Tags: Diagram
Allen Caughran
Asked On November 20, 2012 02:10 PM UTC

I have a user control that is hosted in a ControlNode.  On the control I have a button that when clicked I change the size of the user control to either expand or shrink the control's size.  I would like to have the Control Node's size to change with the controls node.

Amsath Ali M [Syncfusion]
Replied On November 26, 2012 10:57 AM UTC

Hi Allen,


Thanks for your interest in Syncfusion products.


We suggest you to use the ControlNode.HostingControl’s ‘SizeChanged’ event to update the controlNode’s size when the HostingControl’s size changed. Please refer the below code snippet to achieve your requirement.


Here is the code:


cnode.HostingControl.SizeChanged += new EventHandler(HostingControl_SizeChanged);


void HostingControl_SizeChanged(object sender, EventArgs e)



            cnode.Size = cnode.HostingControl.Size;

            cnode.HostingControl.Location = new Point((int)cnode.BoundingRectangle.X, (int)cnode.BoundingRectangle.Y);           





Here is the sample:



Please let us know if you have any queries.



Amsath Ali. M


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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