所以我试图弄清楚 Form 的 AutoScaleMode 属性如何帮助支持带有字体或 DPI 的系统。这与我的工作开发机器不同。
从SDK:
AutoScaleMode Enumeration
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 表单使用 AutoScaleMode.Font。
所以我在我的 Windows XP、Tahoma 8 pt、96 DPI 开发机器上设计了一个示例表单。然后我在一个
结果并不令人鼓舞,正如您在此屏幕截图中所见:
AutoScaleMode 属性并非旨在启用 .NET 表单以支持不同的字体或 DPI 设置。那又怎样是 支持不同字体和 DPI 设置的正确方法?
最佳答案
正确的方法是缩放控件、表单本身和其中的文本。这听起来很复杂,但布局控件(TableLayoutPanel 和 FlowLayoutPanel)与 AutoSize 属性相结合,大大降低了难度。
关于.net - 支持 DPI 和默认字体更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/196606/