Background color for Tabcontrol in c# windows application
<p>I am trying to add font color and background color for tabs created in the tabcontrol and also background color for the place which is empty without tabs. Because my tabcontrol is stretched to the size of my full screen form. Say if only one tab is created in the tabcontrol, the tab background color should be in blue color and the rest place of tabcontrol should be in Dark blue color. The default color is grey for that, which is very ugly.</p>

<p>I am using the below code, which works fine for font color and background color of tab. But i am not getting the bg color for rest of the places.</p>

<p>am i missing anything ?</p>

<pre><code>     private void tabControl1_DrawItem_1(object sender, DrawItemEventArgs e)
    {
            //set color for Background
            Brush BG_BackBrush = new SolidBrush(Color.FromArgb(111, 111, 111)); //Set background color 
            //Rectangle BG_r = e.Bounds;
            Rectangle BG_r = new Rectangle(1682, 34, this.Width - 2, this.Height - 2);
            BG_r = new Rectangle(BG_r.X, BG_r.Y + 8, BG_r.Width, BG_r.Height - 3);
            e.Graphics.FillRectangle(BG_BackBrush, e.Bounds);


            //set color for Tabs
            Font TabFont;
            Brush BackBrush = new SolidBrush(Color.FromArgb(147, 188, 200)); //Set background color
            Brush ForeBrush = new SolidBrush(Color.FromArgb(11, 51, 106));//Set foreground color  


            if (e.Index == TaskBarRef.tabControl1.SelectedIndex)
            {
                TabFont = new Font(e.Font, FontStyle.Bold);
            }
            else
            {
                TabFont = new Font(e.Font, FontStyle.Regular);
            }
            Rectangle r = e.Bounds;
            r = new Rectangle(r.X, r.Y + 8, r.Width, r.Height - 3);

            string TabName = TaskBarRef.tabControl1.TabPages[e.Index].Text;
            StringFormat sf = new StringFormat();
            sf.Alignment = StringAlignment.Center;

            e.Graphics.FillRectangle(BackBrush, e.Bounds);
            e.Graphics.DrawString(TabName, TabFont, ForeBrush, r, sf);

            sf.Dispose();




            if (e.Index == TaskBarRef.tabControl1.SelectedIndex)
            {
                TabFont.Dispose();
                BackBrush.Dispose();
            }
            else
            {
                BackBrush.Dispose();
                ForeBrush.Dispose();
            }
    }
</code></pre>
