AutoScaleMode AutoScaleMode AutoScaleMode AutoScaleMode Enum

定义

指定 Windows 窗体支持的不同类型的自动缩放模式。Specifies the different types of automatic scaling modes supported by Windows Forms.

public enum class AutoScaleMode
public enum AutoScaleMode
type AutoScaleMode = 
Public Enum AutoScaleMode
继承
AutoScaleModeAutoScaleModeAutoScaleModeAutoScaleMode

字段

Dpi Dpi Dpi Dpi 2

控制有关显示分辨率的缩放。Controls scale relative to the display resolution. 常见的分辨率是 96 DPI 和 120 DPI。Common resolutions are 96 and 120 DPI.

Font Font Font Font 1

控制有关类使用的字体(通常是系统字体)尺寸的缩放。Controls scale relative to the dimensions of the font the classes are using, which is typically the system font.

Inherit Inherit Inherit Inherit 3

根据类的父级的缩放模式控制缩放。Controls scale according to the classes' parent's scaling mode. 如果没有父级,则禁用自动缩放。If there is no parent, automatic scaling is disabled.

None None None None 0

已禁用自动缩放。Automatic scaling is disabled.

注解

ContainerControl类和类派生自它,如Form,可以自动调整自身大小,并根据当前系统字体或分辨率显示,其内容以每英寸点数 (DPI)。The ContainerControl class and classes derived from it, such as Form, can automatically resize themselves and their contents according to either the current system font or the resolution of the display, measured in dots per inch (DPI). AutoScaleMode枚举定义支持这些类和其派生的类型的自动缩放模式。The AutoScaleMode enumeration defines the automatic scaling modes supported by these classes and their derived types. 可以通过访问控件的当前模式及其ContainerControl.AutoScaleMode属性。A control's current mode can be accessed through its ContainerControl.AutoScaleMode property.

大多数业务应用程序应使用的字体自动缩放模式。Most business applications should use the Font automatic scaling mode. Dpi 缩放模式可用于基于图形的应用程序,与使用.NET Compact Framework 的默认缩放兼容。The Dpi scaling mode is useful for graphics-based applications and is compatible with the default scaling used by the .NET Compact Framework.

重要

在.NET framework 1.0 和 1.1 版中,自动缩放已支持使用始终依赖于当前的系统字体的简单机制。In the .NET Framework versions 1.0 and 1.1, automatic scaling was supported using a simpler mechanism that always relied on the current system font. 此机制现已过时,但仍受支持的向后兼容性。This mechanism is now obsolete but still supported for backward compatibility. 你可以通过设置获取较旧的缩放行为AutoScale属性包含Formtrue,它还将隐式将设置ContainerControl.AutoScaleMode属性为无。You can obtain the older scaling behavior by setting the AutoScale property of the containing Form to true, which will also implicitly set the ContainerControl.AutoScaleMode property to None. 相反,设置ContainerControl.AutoScaleMode窗体的属性将设置AutoScalefalse,启用.NET framework 2.0 版引入的较新的缩放机制。Conversely, setting the ContainerControl.AutoScaleMode property of a form will set AutoScale to false, enabling the newer scaling mechanism introduced with the .NET Framework version 2.0.

请注意,对于智能手机应用程序,此枚举要求 Windows Mobile 版本 5.0 软件智能手机。Note that for Smartphone applications, this enumeration requires Windows Mobile Version 5.0 software for Smartphones.

适用于

另请参阅