Solved

Form Font Scaling in Apps Installed on Windows 7-How To Stop?

Posted on 2014-04-11
3
443 Views
Last Modified: 2014-04-23
I have an application programmed in Visual Studio and when installed on a Windows PC where the text is set to Medium or Larger, the text on my forms autosizes. Does anyone know how to stop the autosizing? I have tried changing the form option of AutoScaleMode to None along with other things but the text continues to autosize. If anyone could tell me how to stop this that would be great.

The Windows font size setting is under Screen Resolution, Make text and other items larger or smaller.
0
Comment
Question by:vb9666
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Did you turn off autoscaling at control level as well? Is it winforms or WPF app?
0
 

Author Comment

by:vb9666
Comment Utility
It's a windows from application. And the controls are set to AutoSize = False. There is not autoscalemode property on the controls.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
Comment Utility
Disabling scaling would not fix the issue though. Here is an explanation

You'll have bigger problems when you change the AutoScaleMode property. Increasing the DPI also changes the system font size. Necessarily so, font sizes are expressed in points, 1/72 inch. The fonts need to be bigger to get the same point size when the DPI increases.

Since the controls don't get resized anymore, the text on, say, a button no longer fits. One way to battle this is to change the font size on the controls proportionally. Easy if you let all the controls inherit the form font, just changing the form's Font property automatically updates the controls as well. The clear disadvantage is that the user will have a harder time reading the text. This especially gets bad when the DPI goes to 150 DPI and beyond, your UI just becomes unusable.

Yes, background images need to get scaled to fit the larger control or form. A pixel in the image now no longer maps one-to-one to a pixel on the screen. The default Graphics.InterpolationMode value does a very decent job of filtering the image. But it depends on the kind of image how well that turns out. A photo almost always scales very well. Finely detailed line art does not. Picking the right kind of image goes a long way to avoiding having to create separate ones.

This problem isn't going to go away until monitors start to have the kind of resolution a printer has. We're still a long way from 600 DPI.




I had the same problem with one of my applications. The answer was to move it to WPF. The solution that I came with when I still used WinForms was to have 2 executable files. One developed under 96DPI and the other under 120DPI. It was double effort, but I have tried any layout configurations without success. If my controls were looking fine on 96DPI, when switching to 120DPI, they were out of the window's application. And viceversa.

WPF is the only solution to this annoying problem.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now