Resize in Windows Forms controls along with form resize

前端 未结 2 2020
心在旅途
心在旅途 2021-01-14 02:38

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 exam

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-14 03:13

    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.

提交回复
热议问题