Auto resizing controls on full screen in windows forms

Pankaj Nagarsekar picture Pankaj Nagarsekar · Sep 19, 2012 · Viewed 9.6k times · Source

I want to auto resize my windows form controls on fullscreen. I use tableLayoutPanel and anchoring.

But it's not pleasing to the eyes. I used flowLayoutPanel, but it doesn't work. I have around 35 controlrs on one single form, including labels, textboxes, comboboxex, radiobuttons, datagridview and checkbox.

Is there any other method by which I can resize the controls? And if not, can anybody suggest me a way to use the tableLayoutPanel and anchoring more effectively?

Answer

Aaron Deming picture Aaron Deming · Sep 20, 2012

It seems to me that what you want to use is the Dock property of all controls as well as using TableLayoutPanel. From the images you provided it looks like you want want the top half of the form to be a TableLayoutPanel, and to set the Dock Property to DockStyles.Fill. Then set the bottom ListView to DockStyles.Bottom.

You can either dock each control in a TableLayoutPanel cell or set the Anchor properties to AnchorStyles.None to make the controls automatically be centered in the cells.