How to prevent any form resizing in VS2022 Windows Forms?

Jaeden Ruiner 126 Reputation points

Okay, I have been working on a Wizard based VSIX installing templates into VS2022 for my place of employment. They are typically simple forms, that utilize a variety of controls - many of them customized. The latest updated (17.9) for VS2022 affected some aspect of "DPI Handling". Whatever it was has destroyed my ability to design my own forms my way.
I define a form, 400x300, with textboxes that are 21 in height and buttons that are 75x23, with a font of Microsoft Sans Serif at 8pt type. I build it, install it, and when i run it, it's 5 times as big. It's massive. I go back to the project, and open up the form in the designer, and suddenly, the buttons are 240x65 and the font size is 24 pt type - which i never directed it to do. Now, yes, I run on a 4k monitor. My DPI is set to 100%, and the Font size is set to 100% at the windows 10 level. Yet for some reason, Visual Studio, or windows is assuming that because I have ZERO dpi zoom affect on, it is their responsibility to massively magnify my form for users with bad vision. And this is happening at the Visual Studio / Compile level. Older programs that I compiled under 2019 with the same basic and custom user controls run just fine. Only the new programs compiled under 2022 are faulty. (yes faulty, this is a MAJOR bug in VS2022)
I need to enforce the ability that when I design a form with 8pt font size and 75x23 dimension buttons, that nobody changes that, because now all my forms are too big to be seen on my 4k monitor. Think that one through before you respond. My forms are not designed too big, they are fine, and they work on a 1920x1080 resolution just fine, and worked with VS2019 just fine. But now on my 4k monitor with absolutely ZERO zoom effects at the Operating System level, are now suddenly magnified beyond the confines of a 4k resolution! I need to disable this behavior ENTIRELY in VS2022. What I design is what I want to see - I choose, not the computer. If it is too small to read, then I affect the DPI settings at the OS level to change that, not VS2022 trying to change at build time it out of some idiotic assumption that it is smarter than the developer. Thanks Jaeden "Sifo Dyas" al'Raec Ruiner

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,825 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,593 questions
{count} votes