Link to home
Start Free TrialLog in
Avatar of eekj
eekj

asked on

TabPage Color

Hi,

I need to change the backcolor of a TabControl (not the individual TabPages). How should I do this? Any code/links appreciated!

Edit: More specifically, I just want to change the colour behind the TabPage Tabs, so it doesn't look awkward after Ive changed the color of the TabPages themselves.
ASKER CERTIFIED SOLUTION
Avatar of Lacutah
Lacutah
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i imagine you've already checked out the   tabcontrol.backcolor  property?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ccuster68
ccuster68

Lacutah,
This was great, here is the c# code for the same thing...
 

private void tabControl_DrawItem(object sender, DrawItemEventArgs e)
{
     // This draws the background.
     e.Graphics.FillRectangle(Brushes.Black, e.Bounds);
     // Get the correct text to draw from the text property of the page  
     // that you're drawing for
     string txtStr = tabControl.TabPages[e.Index].Text;
     // Draw the string, in this case, I made the text White, 
     // and the +3 merely offsets the text from the upper left corner of the tab.
     e.Graphics.DrawString(txtStr, tabControl.Font, Brushes.White, e.Bounds.X + 3, e.Bounds.Y + 3);
}

Open in new window