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

GridBagLayout and AutoSize

Thread ID:





62179 Jun 8,2007 09:57 PM UTC Jun 27,2007 12:13 PM UTC WinForms 3
Tags: Tools
Stephen Guo
Asked On June 8, 2007 09:57 PM UTC

I have a collapsible panel, that grows or shrinks when you click on a + button in the panel (this basically sets the Size property of the panel).
This control is added to a form with Autosize=true and AutoSizeMode=GrowAndShrink along with a label and a GridBagLayout to position the controls. Now when the + is clicked, the form grows to fit the contents, but when it is clicked again and the panel collapses, the form doesn't shrink to fit the contents. It shrinks a bit, but doesn't go back to its original size. Is there any way I can have the form resize to its original size?

Also, when the collapsible panel is expanded/collapsed, I see flickering in the control. How do I prevent this?

I've tried laying out the controls without a gridbaglayout and everything seems to work fine.


Golda Rebecal [Syncfusion]
Replied On June 12, 2007 10:52 AM UTC

Hi Stephen,

I am afraid that I am not able to reproduce the issue of form having GridBagLayout not shrinking to fit the contents when the panel collapses with the attached sample.

Also I am not able to see any flickering when the panel is expanded or collapsed.

Could you please modify the attached sample so that the issue could be seen clearly? This will help us to resolve the issue soon.

We appreciate your interest in Syncfusion products.


Best regards,

Stephen Guo
Replied On June 18, 2007 06:20 PM UTC

Ok, I don't see the two problems I mentioned in this example for some reason. However, when I set the label in position 1,1 in the grid bag layout I notice two other problems:

1) When the collapsible control is expanded for the first time, the top left of the control is cut off. Is there anyway to make the form and the collapsible control expand so that the collapsible control is fully visible?

2) When the form is first shown, collapse the control once, then expand. The new state looks different than the original state (the collapsible control again is cut off).

Attached is a sample.


Golda Rebecal [Syncfusion]
Replied On June 27, 2007 12:13 PM UTC

Hi Stephen,

We can make the collapsible control fully visible when it is expanded by using the TopMargin property of the GridBagLayout.

I have modified the sample you have given and attached it. Please have a look at it and let me know if this helps you.


Best regards,


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