tags:

views:

368

answers:

1

hello,

i have 3 custom controls, that i want to place in a resizable window next to each other. when the window is being resized, these controls should also resize, each taking 33% of the available width.

i tried to use a table layout, but it seems the table only grows, but never shrinks.

thanks for any help on this!

+8  A: 

You can use a TableLayoutPanel, with 3 columns each of size "33% percent". Then you put each of your control in the panel, and set the anchor property as you wish (for example right-left if your control should resize themselves only on the horizontal plane).

Your TableLayoutPanel should also have its property Dock set to True so that he can occupy all your window and resize accordingly.

Ksempac
thanks but that is exactly what i did already, but as i said the tablelayout only grows, but never shrinks
clamp
There are several things you need to check : Did you set the Dock property of your control ? If you didn't, what are the values of its Anchor property ? Does the layout resize itself in all directions ? Are you sure the layout isn't resizing ? If the layout tries to resize, but your control don't (because they haven't no anchor or dock property set) you won't see it.
Ksempac
Sorry in the first question i meant "Did you set the Dock property of your TableLayoutPanel ?".
Ksempac
the anchor of the tablelayout is set to top,left,right,bottom. i.e. it resizes in all directions. i dont want to set the dock property since it would overlap other controls. so yes, the tablelayout resizes in all directions but does not shrink anymore. inside the tables of the tablelayout i have set the control's dock to fill.
clamp
Did you check that your layout's columns are set to a size in percent and not a fixed size ? Sorry if the question seems stupid, but I try to go through all possible problems. I know tablelayoutpanel works, since I'm currently creating Outlook 2007 forms with this kind of layout everywhere.
Ksempac
yes, they are in percent. and actually the enlarging works pretty well. all three components scale at 1/3 of the total available width. it's just the shrinking that does not work. the components just stay at their current size and look cropped.
clamp
Do your controls/layout have a minimum size set ? What kind of controls do you use in your layout (i know they are custom, but i suppose they inherit/looks like one or more standard controls) ?
Ksempac
try setting AutoSizeMode property to GrowAndShrink
AB Kolan
their minimum and their maximum size is set to 0,0.the custom control is a colleciton of sliders, buttons, textboxes.and i was a wrong on the fact that they are directly inside the tablecell. actually there is a groupbox between them. so it is:table->tablecell->groupbox->customcontrolsorry about that!GrowAndShrink didnt help
clamp