如何在Visual Studio IDE中更改表单控件的默认字体 [英] How to change the default font of the form controls in Visual Studio IDE

查看:267
本文介绍了如何在Visual Studio IDE中更改表单控件的默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to set the default font of the form components from Microsoft Sans Serif to MS Outlook

我每次在窗体上放置一个新控件时都可以更改字体,但是这很耗时.在Visual Studio 2012中找不到任何帮助或选项.

I can change the font every time I put a new control on the form but its time consuming. I didn't find any help or options for it in the Visual Studio 2012.

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

How can I change the default font for any added control?

推荐答案

您添加到窗体的许多控件,默认情况下是窗体的某些属性.其中包括表单的Font及其BackColor.如果要使用所有控件,请说Consolas,10.

Many Controls you add to a Form, default to some of the Form's properties. That includes the Font of the Form as well as its BackColor. This comes handy if you want to use, say Consolas,10 for all Controls..

这是这些环境属性" ..:

周围属性是控件上的属性,如果未设置,则为 从父控件中检索.如果控件没有 父级且未设置该属性,则控件会尝试查找 通过站点"属性获得的环境属性的值.如果 控件未定位,该站点不支持环境属性,或 该属性未在AmbientProperties对象,Control上设置 使用其自己的默认值.从控件派生的一些对象 类可能会设置该属性,即使您未设置该属性也是如此.例如,表格 类始终设置ForeColor和BackColor属性.

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.

TextBoxes and some other Controls don't get the Backcolor, though.

注意:更改窗体的字体将更改窗体上所有控件(包括文本框,列表等)的继承"字体.但是,直接设置的那些属性不会更改.

Note: Changing the Form's font will change those 'inherited' Fonts of all Controls on the Form, including TextBoxes, Lists etc. Those properties you have set directly will not change, though.

因此:如果您想使用各种字体,请首先正确获取窗体的字体,并尝试避免默认值和设置值的不受控制的混合! (您可以检查在From.Designer.cs文件中设置了哪些.)

So: If you want to use varying Fonts, get the Form's Font right first and try to avoid an uncontrolled mix of default and set values! (You can check which you have set in the From.Designer.cs file..)

这篇关于如何在Visual Studio IDE中更改表单控件的默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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