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. Image for the cookie policy date
close icon

GridBagLayout and Resizing

Hello. I am attempting to create a form which uses the GridBagLayout control for the primary layout. I have two panels on the form, arranged in a 1 column by 2 row arrangement. The top panel contains a handful of textboxes which are additionally positioned by the FlowLayout control. The bottom panel contains a single textbox which is to resize as the panel resizes (both height and width).

I am able to successfully resize the form vertically and have it behave as desired (the top panel remains at a fixed height, and the bottom panel increases and decreases in height). I cannot identify the appropriate configuration to have the form behave as desired when modifying the width. In particular, as the form width is increased, the FlowLayout in the top panel enables the inputs to move into a side-by-side orientation. The FlowLayout also resizes the panel containing the controls (as evidenced by the border I displayed). Unfortunately, the second panel does not move to fill the space as the top panel is flattened, and I end up with a large gap between panels.

How do I need to configure the layout managers so that the panels fill all available space? Essentially, I want the bottom of the top panel and the top of the bottom panel to stay "glued" together, and as the top panel increases width and decreases height, I want the bottom panel to increase its height accordingly.

Can this scenario be implemented using the controls I''ve specified?

Thanks for any help you can give.

4 Replies

MJ Mano J Syncfusion Team September 12, 2006 01:04 AM UTC

Hi John,

Our apologises for the delay in getting back to you.

We are working on a sample. I will update you within one day.

Thanks,
Mano


PR Purusothaman R Syncfusion Team September 12, 2006 05:15 PM UTC

Hi John,

I have created a sample, based on which I have understood the given scenario. Kindly refer to the Layout properties and Constraints of the Panels placed on the Form.

Let me know, whether this is what you need.

Thanks for using Syncfusion Products.

GridLayout.zip


Regards,
Purusothaman.R


RP Ramesh Praveen Syncfusion Team September 12, 2006 08:15 PM UTC

John,

Here is another try at implementing what you want (see attachment).

This version is much simpler. There is a flowlayout controling the child positions in the top panel. Then the top panel is docked to top and the bottom panel is docked to fill. That''s about it.

Let us know if this will work for you.

Regards,
Praveen Ramesh
Syncfusion




Layout_Modified_91206.zip


AD Administrator Syncfusion Team September 19, 2006 08:05 PM UTC

Praveen,

I believe that using the standard WinForms docking properties should be sufficient for my purposes. I originally wanted to be able to keep the bottom segment from sizing too small (through using the Layout Manager minimum size settings), but until I find otherwise, simplicity wins in this case.

I will implement the docking. Thanks for your assistance.

>John,

Here is another try at implementing what you want (see attachment).

This version is much simpler. There is a flowlayout controling the child positions in the top panel. Then the top panel is docked to top and the bottom panel is docked to fill. That''s about it.

Let us know if this will work for you.

Regards,
Praveen Ramesh
Syncfusion




Layout_Modified_91206.zip

Loader.
Live Chat Icon For mobile
Up arrow icon