Transfer from http://www.cnblogs.com/KenBlove/articles/1281823.html
Sometimes you will find that the WinForm program is not the right size to display on another machine. These problems occur mainly in background pictures, picture frames, window layouts. Then it's probably because of the WinForm auto-scaling function.
Because systems of different languages use different default fonts, systems with the same font may also use different dpi (dots per inch of characters), and traditional Win32 programs often encounter problems with text displays on different systems. NET WinForm provides automatic scaling to try to fix the problem. In the v1.1, the form has a Autoscale attribute, but it incorrectly writes the scaling attribute into shape, causing the system to become a waste that can only be messed up. In v2.0, the automatic retraction system is redesigned and the AutoScaleMode attribute is added to the form's base class ContainerControl, providing several different auto-scaling modes to meet the needs of different types of interfaces:
1. DPI: Controls are indented based on changes in the relative design-time Dpi. The common DPI is 96 and 120. This mode is only useful for some specific graphical controls.
2. Font: Controls are indented based on changes in relative design-time fonts. Because the size and height of the font change is often different, this approach results in a wide and high unequal ratio. This mode is the default value for EXE projects. This is appropriate for dialogs that contain text labels and system controls, but once you have a fixed-size control or a control that needs to maintain a wide-height ratio, you can easily ruin the original layout.
3. Inherit: Use the parent control's mode. This option is often used for custom controls.
4. None: not auto-shrink. This is the only option when other modes are unable to achieve a reasonable effect.
There is a warning in MSDN that it is not supported to mix DPI mode with font mode in the same window. But in my practical experience, the dock and anchor, which are automatically indented and window-laid, sometimes conflict. This means that the current auto-scaling function is still not ideal.
In fact, one of GDI + 's design goals is to solve the problem of text reduction. But GDI + has stopped developing before implementing all of its functions, and has not gotten hardware acceleration, and GDI is constantly upgrading, so GDI's text function is far more than GDI +. Even worse, some texts, especially those in the Arabic language system, are not displayed correctly or at all, under GDI +. So, the WinForm of. NET 2.0 can only be returned to the GDI system, wrapping the GDI text feature, also known as the TextRenderer class, to provide a correct and clearer and more efficient text display.
(The above content is from the network)
Set the Form to this. AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
The controls below are set to
This. AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
can solve the problem.
A word of knowledge: How to solve the layout problem caused by WinForm auto-scaling.