'Upgrading .net frame work to .net 6 win forms results in UI being larger
I i've upgraded winforms from .net framework to .net 6 without compile issues an builds and runs however as the UI is slightly larger. This makes most of the app out of order in terms of size (things are getting cut off or not appearing as they are off the control etc).
i've checked the designers for both controls and the size values are the same between the framework version and .net 6 version is there some setting in the project files which was shrinking control UI in .net framework?
an example this is the .net framwork version
and this is the .net 6 version
below is what it looks like at run time, the .net6 being in red and .netframework version being in blue
Solution 1:[1]
Adding this line seems to have resolved the issue in the startup / program.cs class https://www.codeguru.com/csharp/windows-forms-gets-font-changes-designers-and-more-in-net-6-0/
[STAThread]
public static void Main(string[] args)
{
.....
Application.SetDefaultFont(new Font(new FontFamily("Microsoft Sans Serif"), 8f));
......
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | UndeadEmo |