Resizing Anchored Group Boxes

compguru910

Well-known member
Joined
Nov 25, 2009
Messages
47
Programming Experience
3-5
Alright, this is something that ive been trying to figure out for a while, but I cannot seem to figure out. Ive tried googling it, but cant seem to get the write keywords for the results. This is what im trying to do. I got two groupboxes side by side, and I need both of them to take up 50% of the container they are in, when they are resized, I need one to go from the left side of the container, to 50% into the center, and the other one to start where that left off, and go to the right side. Ive tried Anchoring the first to left, top and right, and the left to top and right, and a few other combinations, but the one on the left bleeds into the one on the left. It seems like the starting x position of the right box doesnt change. Any help would be appreciated.
 
Last edited by a moderator:
This is easiest done with adding a SplitContainer control (Dock=Fill) to your container, with a GroupBox (Dock=Fill) in each panel. If you want to maintain a fixed split set IsSplitterFixed=True and SplitterWidth=1, and use the parents Resize event to set SplitterDistance to calculated 50% width of parents ClientSize.Width.
 
Back
Top