问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/8892490/how-to-change-the-font-property-of-a-tab-control-without-changing-the-font-of-it