1

In my winform project I need to increase the font size of the TabControl items, but if I increase the size, also the content of the TabControlchanges the own size... any ideas?

I also want to change the background of the TabControl palette (not the entire tabControl).

enter image description here

leppie
  • 115,091
  • 17
  • 196
  • 297
ghiboz
  • 7,863
  • 21
  • 85
  • 131

1 Answers1

4

If you want to change the font and back color of tab pages without changing the font and back color of child controls, you should know:

The Font and BackColor properties are ambient properties.

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. For more information about ambient properties, see the AmbientProperties class or the Control class overview.

You can set the Font and BackColor for each tab page explicitly. This way, the child controls of tab pages, use Font and BackColor of TabPage.

You can explicitly set control's ambient properties to prevent them from using parent's property value.

(Thanks to TaW for better option rather than using panel as container of controls in the tab page.)

Community
  • 1
  • 1
Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • 1
    As all content must live inside the TabPages it is enough to set the TabPages' fonts to the smaller size. – TaW Jan 14 '16 at 10:59
  • @TaW Great! Yes. You are completely right, `TabPage` is also `Control` and follows the rule for ambient properties. So it's enough to set the `Font` and `BackColor` for `TabPages` – Reza Aghaei Jan 14 '16 at 11:05