Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize in Windows Forms controls along with form resize

I have a few controls (group boxes, tables, gridview, etc.) in my C# Windows Forms application, and I would like to scale them based on screen width/height.

For example, the screen starts at, let's say, 640x480 and then it gets maximized to 1920x1200.

I want to be able to increase the width/height of the controls so they look the exact same after the window gets re-sized.

What is the best way to do that, without setting every width/height property manually?

like image 787
sd_dracula Avatar asked Dec 26 '22 04:12

sd_dracula


1 Answers

What is the best way to do that, without setting every width/height property manually?

Instead of specifying width and height, you can use the Anchor and Dock properties to have controls scale based on their containing elements.

Alternatively, you can use TableLayoutPanel or FlowLayoutPanel to arrange your controls.

like image 185
Reed Copsey Avatar answered Jan 18 '23 03:01

Reed Copsey