winforms - 如何更改 Visual Studio IDE 中表单控件的默认字体

标签 winforms visual-studio fonts

我想将表单组件的默认字体从 Microsoft Sans Serif 设置为 MS Outlook

每次在表单上放置新控件时,我都可以更改字体,但这很耗时。我在 Visual Studio 2012 中没有找到任何帮助或选项。

如何更改任何添加的控件的默认字体

最佳答案

添加到表单的许多控件,默认为表单的某些属性。其中包括表单的Font 及其BackColor。如果您想对所有控件使用例如 Consolas,10 ,这会很方便..

这是关于这些 'ambient properties' 的 MSDN ..:

An ambient property is a property on a control that, if not set, is retrieved from the parent control. If the control does not have a parent and the property is not set, the control tries to find the value of the ambient property through the Site property. If the control is not sited, the site does not support ambient properties, or the property is not set on the AmbientProperties object, the Control uses its own default values. Some objects derived from the Control class might set the property even if you do not. For example, the Form class always sets the ForeColor and BackColor properties.

TextBoxes 和其他一些控件没有获得Backcolor

注意:更改表单的字体将更改表单上所有控件的“继承”字体,包括文本框、列表等。不过,您直接设置的那些属性不会更改。

所以:如果您想使用不同的字体,请首先正确设置表单的字体,并尽量避免默认值和设置值的不受控制的混合! (您可以检查您在From.Designer.cs文件中设置的内容..)

关于winforms - 如何更改 Visual Studio IDE 中表单控件的默认字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26636268/

相关文章:

.net - 是否可以在 Winforms TreeView 中使节点不可见?

javascript - 引用整个目录 typescript

c# - 当非双击时如何处理 WinForms 控件单击事件

c# - 如何在 WPF 中动态导出图表?

.net - 使用 Slow Cheetah 转换 Nuspec 文件

c++ - Visual Studio 2010 SP1 中的 64 位整数初始化错误

python - 将通用字体方案应用于 wxPython 中的多个对象

ios - 更改导航栏标题字体 - 不同

java - 删除斜体或粗体,而不删除其他格式

c# - 在 FlowLayoutPanel 内部使用时控件重叠