ContainerControl.AutoScaleDimensions ContainerControl.AutoScaleDimensions ContainerControl.AutoScaleDimensions ContainerControl.AutoScaleDimensions Property

定义

获取或设置控件的设计尺寸。Gets or sets the dimensions that the control was designed to.

public:
 property System::Drawing::SizeF AutoScaleDimensions { System::Drawing::SizeF get(); void set(System::Drawing::SizeF value); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.SizeF AutoScaleDimensions { get; set; }
member this.AutoScaleDimensions : System.Drawing.SizeF with get, set
Public Property AutoScaleDimensions As SizeF

属性值

包含每英寸点数 (DPI) 的 SizeF,或为控件设计的 Font 大小。A SizeF containing the dots per inch (DPI) or Font size that the control was designed to.

异常

设置 SizeF 值时,其宽度或高度小于 0。The width or height of the SizeF value is less than 0 when setting this value.

注解

AutoScaleDimensions属性表示控件缩放到或设计为的屏幕的 DPI 或字体设置。The AutoScaleDimensions property represents the DPI or font setting of the screen that the control was scaled to or designed for. 具体而言,在设计时,Windows 窗体设计器会将此属性设置为监视器当前使用的值。Specifically, at design time this property will be set by the Windows Forms designer to the value your monitor is currently using. 然后,在运行时加载窗体时,如果CurrentAutoScaleDimensions属性与不同AutoScaleDimensions,则PerformAutoScale调用方法以执行控件及其所有子控件的缩放。Then, when the form loads at run time, if the CurrentAutoScaleDimensions property is different from the AutoScaleDimensions, the PerformAutoScale method will be called to perform scaling of the control and all of its children. 之后, AutoScaleDimensions将更新以反映新的缩放大小。Afterwards, AutoScaleDimensions will be updated to reflect the new scaling size.

有关自动缩放的详细信息,请参阅Windows 窗体中的自动缩放For more information about automatic scaling, see Automatic Scaling in Windows Forms.

适用于

另请参阅