The form looks different on another computer

When I create my form on my machine, it looks fine, but when it compiles on another computer, the size of the form itself is wrong. Shortcuts move and things no longer align properly.

How can I guarantee that everything will look the same on any computer?

I tried setting AutoScaleMode to none, and that helped a bit, but then the labels were partially below the corresponding text fields.

+6
source share
3 answers

Either the font or DPI are different.

And I never found a way to say AutoScaleMode = (most appropriate of font or dpi) .

But try AutoScaleMode = DPI and AutoScaleMode = Font . One of them should work.

We have never found a reliable way to handle this. Our workplace is USED to provide DPI on all workstations, but it has changed since then. The best way to handle this is to make sure that you have customized your controls using FlowLayoutPanel or TableLayoutPanels instead of absolute positioning of the controls.

+5
source

I have had this problem lately and it turns out that compiling with 125% or environment makes binary immune for 100 or 150% changes. You still need to set the AutoScaleMode parameter to None.

0
source

Even if the topic is over, my two cents since I ran into the same problem, the form had a different size (bigger in my case), but the controls where they are the same when fixed. I just solved it by providing the original form of a smaller size than the management, and let it grow automatically.

I also applied the recommendations of this post ( How to write WinForms code that automatically scales to the system font settings and dots per inch? ), But this did not help me with the problem.

0
source

All Articles