Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Way to make a Windows Forms scalable?

Tags:

c#

winforms

What would be the best way to make a WinForms application fully scalable, for example when the Form resizes?

In WPF i would use something like a Viewbox and/or a UniformGrid, but something like this doesn't exists in WinForms.

Is there an easier (and maybe faster) way to rescale controls on a from after resizing it, instead of resizing them all by calculating their new Size/Location etc.?

Thanks in advance

like image 865
BudBrot Avatar asked Jan 13 '23 20:01

BudBrot


2 Answers

In Windows Forms, you use the Anchor and Dock properties for each control.

Here's an article about using them: http://www.techrepublic.com/article/manage-winform-controls-using-the-anchor-and-dock-properties/

You should also look at FlowLayoutPanel and TableLayoutPanel

like image 196
Matthew Watson Avatar answered Jan 21 '23 21:01

Matthew Watson


you can use anchor and dock, depending on your need:

  • Anchor - the edges of the container to which a control is bound and determines how a control is resized with its parent.
  • Dock - which control borders are docked to its parent control and determines how a control is resized with its parent.

for further read: Dock and Anchor

like image 24
No Idea For Name Avatar answered Jan 21 '23 21:01

No Idea For Name