Designer setup for visual studio

I learned how to manage different DPI settings so that at runtime my applications display correctly.

But the design time of Design time Visual Studio is still a big problem. Let's say I create an application with a resolution of 96 dpi, and I will switch my display to 120 dpi for testing purposes.

Now, if I open the form designer with a resolution of 120 dpi, the form will be changed in accordance with 125%, the controls will be moved out loud !: - (((

So I try to avoid re-opening forms, but this is NOT a good solution, is it?

Is it possible to set development time to prevent form changes?

+2
dpi visual-studio resize forms
source share
2 answers

Not a solution, but a workaround is possible: do not test on your computer, but on a virtual machine or another computer, and do not open the solution on a computer with large fonts.

And we found that we cannot use the AutoScaleMode = Dpi.Font parameter. It will randomly resize the shapes when we open them in the designer. Dpi or None seem to work.

+2
source share

Although this question is already old, I want to share my workaround.

  • Save the forms AutoScaleMode = Font . This works great if you manage the rest properly.
  • Install in your form constructor: Font = MS Sans; 11px Font = MS Sans; 11px . Basically, specify your fonts in pixels instead of dots. This way, Visual Studio will not scale if the system DPI changes.
  • In Ctor Forms, after InitializeComponent , reinstall: Font = SystemFonts.DefaultFont . Now at runtime, fonts will again use dot-based sizes and you will get a good high DPI graphic interface.
  • Enable DPI awareness either through the manifest or through the API function SetProcessDPIAwareness

You can find detailed information about my (difficult) study path on my blog: http://www.sgrottel.de/?p=1581&lang=en

0
source share

All Articles