GridBagLayout and AutoSize

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.

Thanks.

3 Replies

GR Golda Rebecal Syncfusion Team 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.

http://websamples.syncfusion.com/samples/Tools.Windows/F62179/Main.htm

Best regards,
Golda


SG Stephen Guo 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.

gridbaglayout_34740_revised.zip


GR Golda Rebecal Syncfusion Team 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.

http://websamples.syncfusion.com/samples/Tools.Windows/F62179_1/Main.htm

Best regards,
Golda

Loader.
Up arrow icon