0
votes

I am having a strange effect when editing a legacy Windows Forms project in Visual Studio 2015 on my new computer with a high DPI (150%) setting. When I edit the project on the laptop screen (DPI 150) everything appears normal and the forms' default font is the standard size of 8pt (note Visual Studio's menus and text all appear correctly), but when I dock the laptop and use on my monitors with a DPI of 100 all the forms get increased to a font size of 15.25. It's almost as if somewhere, when I installed Visual Studio (and SQL Server Management Studio for that matter), they registered the DPI 150% setting as the default and when I drop back down to 100% everything is getting inverted (150/100). Anyone have any experience with this? I can't follow other articles to get my Windows Forms project DPI-Aware if I can't get back to a 96 DPI baseline.

1
What is the value of the AutoScaleMode property of the Form set to? Make a backup of your project and set AutoScaleMode to None and save the project. Now change your DPI setting and see if the problem still exists. If the AutoScaleMode is set, the property AutoScaleDimensions will be recorded in the form.designer.cs (or vb) file. This value is read when you open the project and if things have changed, the form is scaled. - TnTinMn
Thanks. I checked and all of the forms have AutoScaleDimensions set to 6.0, 13.0F (this is the setting for 96 DPI, I believe). So that part seems okay. And when I change the DPI setting to 100 on the laptop screen, everything is fine; it's only when I connect to my monitors through the laptop dock. Now that everything is set to AutoScaleMode = Font; I will have to see how things look once I get back into the office. - L. Marrano

1 Answers

0
votes

I have solved my own issue. Documenting here for anyone else who might have this strange experience. When docked, I had three displays connected, two 1920x1200 monitors through DVI and one 1024x768 projector through VGA. Apparently this extra projector connection was creating some sort of strange DPI issues in Visual Studio's form designer (and SQL Server Management Studio's query results). Disconnecting the VGA connection fixed the problem.