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.

Expand and collapse controlnode

Thread ID:





105819 Nov 20,2012 09:10 AM Nov 26,2012 05:57 AM Windows Forms 1
Tags: Diagram
Allen Caughran
Asked On November 20, 2012 09:10 AM

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 05:57 AM

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.

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.