2

I have made an application in visual C # (Windows Forms), and the monitor of my PC is 1280 x 1024.

The appearance of the form is as indicated in the following figure:

enter image description here

There are several users who have PCs with other resolutions, for example 1024 x 768 and the form looks like this:

enter image description here

I have made all the suggestions I have found in several forums and what I have noticed is that the controls contained in the form are those that must also be resized.

Any suggestions to solve my problem is welcome.

Fabián Romo
  • 319
  • 2
  • 14
  • 1
    [Automatic scaling in Windows Forms](https://docs.microsoft.com/en-us/dotnet/framework/winforms/automatic-scaling-in-windows-forms), [High DPI support in Windows Forms](https://docs.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms). Read the notes [here](https://stackoverflow.com/a/53026765/7444103) about the Screens size and virtual screen, also in relation to the application Dpi Awareness. Start to test setting your Form's `AutoScaleMode` to `Dpi` instead of the default `Font`.Correct Dpi/PerMonitor scaling requires some testing (quite a lot, actually :) – Jimi Jul 12 '19 at 20:43

1 Answers1

4

You should set the Anchor and Dock properties on the controls in the forms.

The Anchor property controls which edges of control are "bound" or "tied" to the corresponding edges of its form. For example, if you set Anchor to Bottom, the distance between the control's bottom edge and the bottom of its parent will not change, so the control will move down as you resize the form. If you set Anchor to Top | Bottom, the control will resize vertically as you resize the form.

To make a control resize with the form, set the Anchor to all four sides, or set Dock to Fill.

MOC
  • 70
  • 7