ContainerControl.CurrentAutoScaleDimensions 属性


获取屏幕的当前运行时尺寸。Gets the current run-time dimensions of the screen.

 property System::Drawing::SizeF CurrentAutoScaleDimensions { System::Drawing::SizeF get(); };
public System.Drawing.SizeF CurrentAutoScaleDimensions { get; }
member this.CurrentAutoScaleDimensions : System.Drawing.SizeF
Public ReadOnly Property CurrentAutoScaleDimensions As SizeF


SizeF,包含当前每英寸点数 (DPI) 或屏幕的 Font 大小。A SizeF containing the current dots per inch (DPI) or Font size of the screen.



未能为当前屏幕创建 Win32 设备上下文。A Win32 device context could not be created for the current screen.


CurrentAutoScaleDimensions属性表示当前屏幕上的引用尺寸。The CurrentAutoScaleDimensions property represents the reference dimensions on the current screen. 与此相反, AutoScaleDimensions该属性表示当前控件的设计环境的设计时引用维度, AutoScaleFactor而属性是两者的比率。In contrast, the AutoScaleDimensions property represents the design-time reference dimensions of the design environment for the current control, while the AutoScaleFactor property is the ratio of the two.

维度值的解释取决于AutoScaleMode属性,方法如下:The interpretation of the dimension value depends on the AutoScaleMode property in the following ways:

  • 如果模式为Dpi,则此属性表示屏幕的分辨率(以每英寸点数为单位)。If the mode is Dpi, this property represents the resolution of the screen, in dots per inch.

  • 如果模式为Font,则此属性表示以像素为单位的平均字体字符大小。If the mode is Font, this property represents the average font character size in pixels.

如果将None属性设置为AutoScaleDimensionsCurrentAutoScaleDimensions则将设置为等于。 AutoScaleModeIf the AutoScaleMode property is set to None, CurrentAutoScaleDimensions is set equal to AutoScaleDimensions.

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