ContainerControl.AutoScaleDimensions 屬性

定義

取得或設定設計控制項的目標維度 (Dimension)。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

屬性值

SizeF,其中含有設計控制項的目標 Dots Per Inch (DPI) 或 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 Forms 設計工具設定為您的監視器目前使用的值。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 Forms 中的自動調整For more information about automatic scaling, see Automatic Scaling in Windows Forms.

適用於

另請參閱