如何在 C# 中更改选项卡控件的字体属性而不更改其子控件的字体?
我想更改选项卡控件的字体,因为我希望选项卡页标题中的文本看起来更大.但是,当我在设计器中更改选项卡控件的字体属性时(我使用的是 MS VStudio 2010),其子控件的字体也会更改(例如标签和树视图),这是我不打算做的.我只想更改标签页的标题字体.
I want to change the font of a tab control because I want the text in the tab page headers to look bigger. But when I change the font property of a tab control in the Designer (I'm using MS VStudio 2010), the font of its child controls change as well (such as labels and treeview) which I don't intend to do. I just want to change the tab pages' header's font.
我想通过循环遍历子控件来更改代码中选项卡控件的子控件的字体属性(如果有).这个想法会有问题吗?
edit: i thought of changing the font property (if there is) of the child controls of the tab control in code by looping through the child controls. would there be any problem with this idea?
Font
属性在大多数 Win-Forms
控件中,如 Label
定义如下.
Font
property in most of the Win-Forms
control like Label
is defined as explained below.
The Font property is an ambient property. An ambient property is a control
property that, if not set, is retrieved from the parent control. For example, a
Button will have the same BackColor as its parent Form by default
如果你想在父级指定一些你不想被子级继承的字体,你必须手动为子控件分配一些其他字体
If you want to specify some font at parent level which you don't want to be inherited by child you will have to manually assign child controls some other font