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.

注解

类及其派生类 ( Form如) 可以根据当前系统字体或显示分辨率自动调整自身及其内容的大小, 以每英寸点数 (DPI) 来度量。 ContainerControlThe 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可以通过将包含Form的的属性设置为来true获取较旧的缩放行为, 这也会将ContainerControl.AutoScaleMode属性隐式设置为 None。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.

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

适用于

另请参阅