I have a project converted from .NET 1.1 to 3.5 being developed in 2008.
If I open the project on Windows 7, it converts the size of everything to 120dpi sizes. If
AutoScaleMode = AutoScaleMode.None;
See also: ContainerControl.AutoScaleMode property
Since I ran into the same issue recently, I wanna share my workaround.
First: KEEP AutoScaleMode = Font
! This will work nicely at runtime to make your application DPI-aware. (Even cool per-Monitor DPI Aware).
However, the WinForms Designer in Visual Studio actually evaluates the fonts sizes based on the system's DPI, and thus rescales whenever it thinks it is necessary. This is the core of the problem. This evaluation is triggered because the fonts usually specify their size in "point" (to give a DPI-independent user experience).
My workaround is to change this for design time:
Font = MS Sans; 11px
. This is basically the OS default font, but specified with pixel-size. So no design-time rescaling will ever take place.Font = SystemFonts.Default
. A good place is in the Ctor right after InitializeComponents
.I wrote the details about my workaround on my Blog: http://www.sgrottel.de/?p=1581&lang=en