如何使用系统字体设置为Windows C#应用程序 [英] How to use system font settings for a Windows C# app

查看:180
本文介绍了如何使用系统字体设置为Windows C#应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关Windows应用程序(C#),是可以调整整个应用程序(包括所有形式)来使用系统字体设置大小,而不是使用固定大小?

For a windows application (C#), is it possible to adjust the entire application (including all forms) to use system font settings for size rather than using fixed sizes?

这是为视力受损的用户谁设置各自的机器上更大的字体大小。是否有可能为应用程序根据什么用户调整字体。

This is for users with visual impairment who have set a bigger font size on their machines. Is it possible for the application to adjust the font according to what the user has.

推荐答案

在你的形式构造(前调用的InitializeComponent()),我会尝试设置你的表格等于Font属性 System.Drawing.SystemFonts.DefaultFont 。如果您的控件(例如:文本框)不指定特定的字体那么我相信他们从父容器(即形式)继承其字体属性。

In the constructors of your forms (before calling InitializeComponent()), I would try setting the Font property of your forms equal to System.Drawing.SystemFonts.DefaultFont. If your controls (ex: textboxes) don't specify a specific font then I believe they inherit their font properties from their parent containers (i.e. forms).

System.Drawing.SystemFonts 类。您可能要调查这些进一步的为好。

There are other more specific system fonts (like the default setting for the Caption's font) in the System.Drawing.SystemFonts class. You may want to investigate those further as well.

这篇关于如何使用系统字体设置为Windows C#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆