Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the Label size changes in resource file?

Working with VisualStudio 2010 SP1 C#, .Net4.0, Visual Source Safe, Windows7

I am working on the same project with a co-worker in Austria, I am currently in Switzerland. When I click on a form in VisualStudio that my co-worker has created, the .resx file is instantly modified. All the label sizes in the file are some how automatically modified. All the controls in the form are then shoved up into the left hand corner of the form. This makes it impossible for me to edit any of his forms.

Could this have something to do with language localization? A hiden setting somewhere in VisualStudio, that automatically tries to adjust label sizes?

Maybe a .Net configuration or someother windows configuration?

like image 505
Bill Worthington Avatar asked Nov 29 '12 14:11

Bill Worthington


People also ask

How do RESX files work?

Resources in . resx files. Unlike text files, which can only store string resources, XML resource (. resx) files can store strings, binary data such as images, icons, and audio clips, and programmatic objects.

What is RESX file in VB NET?

resx) files are a monolingual file format used in Microsoft . Net Applications. The . resx resource file format consists of XML entries, which specify objects and strings inside XML tags.

Are RESX files compiled?

resx file is compiled into a . resource file, which in turn is linked into a . resource. dll satellite file, referred to as a satellite DLL or Language Assembly.


1 Answers

That's because of an auto-generated assignment in the form's Designer.cs file, it would look similar to this:

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

When your co-worker creates a form, the values here are different. That's because he runs the video adapter in his machine with a different resolution, the dots-per-inch setting doesn't match yours. A very common setting is 96 dpi. But operating systems like Vista and up make it very easy to change this setting, it looks like a ruler. With common stops at 125% (120 dpi) and 150% (144 dpi).

Changing this setting makes it easier to read text, a program will use a larger font (measured in points, 1 point = 1/72 inch) on a video adapter with a higher DPI setting. But that also requires controls like Label and TextBox to get larger in pixels to still fit the text. Which is done automatically, that's why you see the form's .resx file change if you enabled localization.

This is an excellent way to ensure that your design will still look good on machines with another dpi setting. But it can be a bit of a pita when you are designing between the two of you. No real fix for that, other than agreeing on a dpi setting.

like image 122
Hans Passant Avatar answered Oct 21 '22 16:10

Hans Passant