Groupbox resizing info/help

Hi

How do I make a groupbox automatically resize to the form that is in being expanded

SITUATION:-

I have Two groups with buttons etc one docked on the right the other docked on the left:-

When I expand the form groupbox1 goes to the right and groupbox2 goes to the left leaving an empty space in the middle of the two groupboxes, how would I expand both group box’s evenly into the empty space in the middle

So that grouptbox1 expands to the left (into the middle) and groupbox2 expands right (into the middle)

Many thanks,

Andy




Answer this question

Groupbox resizing info/help

  • Juan Carlos Ruiz Pacheco

    Sorry about the wait ;)

    If you want the user to be able to resize the 2 groupboxes, then a Splitter will be better suited:

    -- add a Groupbox, and dock it to the right side
    -- add a Splitter, and also dock it to the right side (make it only a few pixels wide, and maybe change its backcolor to make it stand out a bit more)
    -- add a Groupbox and dock it as fill (and you may need to use BringToFront from the rightclickmenu on it, if it's filling the whole form instead of just the area left over)

    Now you can use the splitter to resize both groupboxes during runtime. Splitter has MinExtra / Minsize properties to set the minimumsizes for the filler/docked control.

    If you want to keep a control away from a bottom-edge, then setting its bottom-Margin will keep it away, but that doesn't work on docked controls, so you'd better use a panel of the 30pixels and dock it to the bottom.

    There's a seperate SplitContainer control that has 2 panels divided by a splitter, so you could use a vertical SplitContainer first to fill the form (leftpanel+splitter+rightpanel), insert a filler groupbox in the right panel, and divide the left panel by another horizontal SplitContainer (toppanel+splitter+bottompanel) with a filler groupbox in the toppanel, and an empty panel in the bottom - you can fix the position of the splitter at 30 pixels from the bottom.


  • Ahsan Ali

    HI,

    Thanks that works well, is there a way that i can make the cells user movabel

    So the user can grab the colum in the middel and pull it left or right

    Many Thanks,

    ANdy


  • pinoyz

    Put a TableLayoutPanel with 2 columns into the form, set its dock to fill, and then put a groupbox in each of the columns and set their dock to fill as well. The TableLayoutPanel will keep them equal in size when stretching the form.

  • jsedlak

    hi,

    another quick question:-

    Is there a way of making the group fill but only a specified distan to the bottom for example tell it to fill but no clsoer to the bottom than 30pixels or cm or inches

    Andy


  • Groupbox resizing info/help