Windows Develop Bookmark and Share   
 index > Windows Forms General > AutoScaleMode enumeration?
 

AutoScaleMode enumeration?

Hi Guys,

Just wondering if anyone can tell me the underlying difference between AutoScaleMode.Font and AutoScaleMode.DPI?

ie what type of scaling do they enforce?

Cheers,
Michael
Michael Weinhardt  Friday, April 29, 2005 6:56 AM
Why Michael,

I'm glad you asked.

Basically, either mode tells a form (or a user control) how its client area will scale as a system's DPI settings change.

If the DPI was changed from 96,96 to 120,120, that would entail a 25% increase in both dimensions. If you use AutoSizeMode.Dpi, this means the form's client area will increase by 25% both in both dimensions, as will all contained controls, other than user controls who can either choose their own AutoSizeMode or inherit their owner form's AutoSize mode using the aptly named AutoSizeMode.Inherit value.

Using the same DPI setting change example, consider that the default font, MS Sans Serif 8.25 pt under Windows XP Normal Fonts (96 DPI), has an average width and height of 6x13. When the DPI increases to 120 DPI, the default MS Sans Serif font's point size drops to 7.8, while its averagewidth and height increases to 8x16. If you use AutoSizeMode.Font (the default), the dimensions of the form's client area (and contained controls) increases with the by the same percentage that the average width and height did. In this example, that's ~33% horizontally and ~24% vertically (err, if my maths is holding up).

In the face of different languages, however, fonts may not scale comfortably under AutoScaleMode.Dpi. If you anticipate this localization/internationalization scenario for your applications, choose AutoScaleMode.Font, which will favor the font and scale appropriately. If you don't, you can get away with AutoScaleMode.Dpi.

Thanks,
Michael

PS Really, thanks to Jessica Fosler and Mark Boulter.
Michael Weinhardt  Tuesday, May 03, 2005 8:19 AM
Why Michael,

I'm glad you asked.

Basically, either mode tells a form (or a user control) how its client area will scale as a system's DPI settings change.

If the DPI was changed from 96,96 to 120,120, that would entail a 25% increase in both dimensions. If you use AutoSizeMode.Dpi, this means the form's client area will increase by 25% both in both dimensions, as will all contained controls, other than user controls who can either choose their own AutoSizeMode or inherit their owner form's AutoSize mode using the aptly named AutoSizeMode.Inherit value.

Using the same DPI setting change example, consider that the default font, MS Sans Serif 8.25 pt under Windows XP Normal Fonts (96 DPI), has an average width and height of 6x13. When the DPI increases to 120 DPI, the default MS Sans Serif font's point size drops to 7.8, while its averagewidth and height increases to 8x16. If you use AutoSizeMode.Font (the default), the dimensions of the form's client area (and contained controls) increases with the by the same percentage that the average width and height did. In this example, that's ~33% horizontally and ~24% vertically (err, if my maths is holding up).

In the face of different languages, however, fonts may not scale comfortably under AutoScaleMode.Dpi. If you anticipate this localization/internationalization scenario for your applications, choose AutoScaleMode.Font, which will favor the font and scale appropriately. If you don't, you can get away with AutoScaleMode.Dpi.

Thanks,
Michael

PS Really, thanks to Jessica Fosler and Mark Boulter.
Michael Weinhardt  Tuesday, May 03, 2005 8:19 AM

Hi All..

Infact i also need some help on this topic i.e AutoScaleMode.Dpi vs AutoScaleMode.Font..

Iam developing an application in VS 2005 and is confused that what is to be used while designing windows form so that when they are opened in computers with high resolution,my text and images etc does not get cut or overlap on other controls.so that they map properly and propotionatly on higher resolutions..

Can anyone help me with some tips to develop it ?

Thanks

rakhee

Rakhee  Friday, November 02, 2007 5:10 AM
I see this thread is very old but I'd like to throw a question into the mix.

I dont care about DPI, if a client has it set to 120 ill tell the to set it to 90 (theres only 1% using 120 at most), I dont care about font size I just fix it at 1 size and they can live with it. What I do care about is screen resolution. There is a wide range of these and accomodating is a pain in the neck and theres no option for it I see? I want to be able to dev a UI on a 960 wide dev machine so it fits the screen and also fit the same full screen on a client 800 wide res. Is there a way to do this or I have I been dumb for the last year or so? Why is there no screen resolution autoscalemode option.
Tiger42  Friday, January 16, 2009 10:37 AM

You can use google to search for other answers

Custom Search

More Threads

• Drag Drop Selected Text
• Validating a user with a Login Form
• Web crawler
• the first C# program and the error
• Restart WebBrowser or MSHTML objects in order to apply browser's setting changes
• is it possible to put dll files in another folder?
• Newbie Problem - Simple Menustrip Rendering Problem
• Removing Listbox Scrollbar
• HELP: how do I load an excel or even docx file into a richtext box?
• click n' drag: easy question (i hope)