Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)

Windows 10, Visual Studio Express 2013, Screen Resolution 1920 x 1080, Text Size 100%

a) I created a simple Winform using the following default values:
Name : Form1
AutoScaleMode : Font
Size: 300,300

b) I added this line to the load event
MsgBox("Height=" & Me.Height & " Width=" & Me.Width & " Scale Factor" & Me.AutoScaleFactor.ToString())

c) I ran the program and it correctly displayed
Height=300 Width= 300 Scale Factor (Width=1, Height=1)

d) I change the AutoScaleMode to DPI
The following values are now displayed
Height=202 Width= 201 Scale Factor (Width=1, Height=1)

e) I change the AutoScaleMode back to Font
The following values are now displayed
Height=198 Width= 201 Scale Factor (Width=1, Height=1)
In the screen design the property size remains at 300 by 300

My questions are:
1) Why has the Height & Width not reverted back to 300 by 300
2) How can I bring the runtime & screen design values back in sync

What I have tried:

I have attempted to change the Form1.Designer.vb file, back to it's original state using a text editor to no avail
Sergey Alexandrovich Kryukov 5-Jun-16 0:47am    
Why would you believe that the size should be reverted? Do you mean to say that your form is not user-resizeable? I would not recommend such design. Now, if you change the form back to its previous content, it should work; you just did not do it accurately, by some reason. Do this exercise again step by step, accurately, and you will see. There is no any mystery here; the code generated by the designer is just code. What else? Don't overuse the designer.
Member 914236 5-Jun-16 1:10am    
My problem is the form size as viewed in the designer property screen (300,300) is not the same as displayed in runtime (198,201). What I see in the design screen and the runtime screen are different.

I can make this anomaly occur by simply changing the autoscalemode from font to dpi and back to font in the design screen.

I have not made any changes to the form other then the autoscalemode described above.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900