Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i change the background color of tabcontainer tab bar in c#?

Tags:

c#

i did't find any property of a tab container to change background color of the bar that contains the tabs how can i do so?

like image 511
Badr Avatar asked Mar 19 '10 11:03

Badr


1 Answers

The background color of a TabControl is inherited from its parent.

Place a panel on the form with the same location and size as the TabControl, put your TabControl inside this panel and set Dock to 'Fill'.

Or the same method in code:

private void Form1_Load(object sender, EventArgs e)
{
    Panel tabBackground = new Panel
    {
        Location = tabControl1.Location,
        Size = tabControl1.Size,
        // Your color here
        BackColor = Color.Magenta
    };
    tabBackground.Controls.Add(tabControl1);
    Controls.Add(tabBackground);
    tabControl1.Dock = DockStyle.Fill;
}
like image 191
jamesrom Avatar answered Sep 21 '22 16:09

jamesrom