所以我试图弄清楚Form的AutoScaleMode属性如何可能有助于支持一个字体或DPI与我的工作开发机器不同的系统。
从SDK:
AutoScaleMode枚举
public enum AutoScaleMode
None Automatic scaling is disabled. Font Controls scale relative to the dimensions of the font the classes are using, which is typically the system font. Dpi Controls scale relative to the display resolution. Common resolutions are 96 and 120 DPI.
默认情况下,.NET 2.0 Forms使用AutoScaleMode.Font。
所以我在我的Windows XP,Tahoma 8 pt,96 DPI开发机器上设计了一个示例表单。然后我在
上试了一下结果并不令人鼓舞,您可以在此屏幕截图中看到:
AutoScaleMode属性未设计为启用.NET窗体以支持不同的字体或DPI设置。那么是支持不同字体和DPI设置的正确方法呢?
答案 0 :(得分:6)
正确的方法是缩放控件,表单本身和文本。这听起来非常复杂,但布局控件(TableLayoutPanel和FlowLayoutPanel)与AutoSize属性相结合,使这一点变得相当困难。