changing BackColor of TabControl


Paiam Salavati

I have to change the BackColor of the unused part to the right of the tabs
in a TabControl.

therefore I have overriden the onPaint-Method of TabControl like this:

protected override void OnPaint(PaintEventArgs e)

Rectangle rectangle = new Rectangle(0, 0, this.Width, this.Height);

SolidBrush brush = new SolidBrush(Color.Blue)

e.Graphics.FillRectangle(brush, rectangle);


the problem is now, that the tabs in my TabControl are not visible anymore,
because they have also the color YellowGreen.

How can I set the backgroundcolor of my TabControl without covering the

does anybody have some experience with that kind of problem?

Any help will be greatly appreciated....


Shouldn't you be calling base.OnPaint(e) AFTER you paint your rectangle?
Otherwise you're simply painting over what base.OnPaint() is painting.



Sorry, I sent that off without thinking. That's not going to work, I don't
believe because base.OnPaint will then probably paint over what you're
painting. Does changing the BackColor property not do what you need?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question