views:

23

answers:

1

We have a WinForms application that includes controls such as picture boxes that are positioned on a form. The base application is in English.

We've translated this application to a number of different languages (French, Spanish, Danish, Greek, etc.) and most recently to Simplified Chinese. The translated application works perfectly on our operation systems (English).

One of our customers installed the application on their operation system, Windows XP in Simplified Chinese. The layout of our application is broken. Simply put, the elements are pushed to the bottom right by a factor that is proportional to the distance between the element and the top left corner. For example, an element at the top right corner in design view is pushed off screen to the right whereas the items at the bottom of the page are pushed downwards and to the right.

The application supports switching languages while in use. When the locale is en-US, there are no layout issues. When switching to Simplified Chinese, the issue appears, but only on the Simplified Chinese operating system. The screen resolution and DPI are the same.

Do you have any ideas? I'm sure it must be a simple configuration setting somewhere, but I have been unable to solve this issue.

+1  A: 

The size of the system base font matters as well. Which is indeed something you can change on XP. This will invoke the form's auto-scaling logic, designed to ensure that the controls grow larger to fit the larger font size.

This is by design, controlled by the form's AutoScaleMode property. Don't change it, rescaling is important. Just make sure the form layout still looks good, use properties like Anchor and Dock, controls like TableLayoutPanel, FlowLayoutPanel. Or the Resize event for tricky ones.

Paste this into your form to test this logic without having to change system settings:

    protected override void OnLoad(EventArgs e) {
        this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * 125 / 96);
    }
Hans Passant
I have no other choice than to completely design the layout of the elements to make it auto-resize the window even if I have a fixed window size? I am assuming the code you paste there should be executed only when the default font family is non-standard? Does the font have an impact on the picture boxes? I would have expected this of zones of text, but not graphical elements.
Jason Kealey
If I understand correctly, disabling the AutoScaleMode would be a simple workaround that would make it appear the same everywhere, but I would lose features when the users of the software that have low vision? (accessibility issue?)
Jason Kealey
Disabling it isn't an option. The text inside the controls will be clipped because the control isn't large enough. Making Chinese characters unreadable.
Hans Passant
I am curious to know why do the Chinese characters fit on a US version of Windows but not the Chinese one? What makes that font size vary from what's defined in the RESX file?
Jason Kealey
I already told you, it is an XP system setting. The option is buried in the Control Panel + Display applet somewhere. Not close to an XP machine right now.
Hans Passant
Thanks - Will go looking for it again to test behaviours.
Jason Kealey