我想将表单组件的默认字体从 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/