Panels side by side taking up 50% width each

Use TableLayoutPanel with one row(100%) and two columns (50% each).


You can use SplitContainer instead of panel. Set IsSplitterFixed to true, in design mode set SplitterDistance to be half of SplitContainer's width and set the SplitterWidth to 1. Make sure that FixedPanel is set to none. Then at runtime it will maintain the ratio of panels widths.

The only problem is that you can't set SplitterWidth to zero so there will always be a slight distance between panels. If that's not a problem and if you don't need the panelContainer to actually be a panel for some reason, that's the way I would do it.

Tags:

C#

Winforms