Tabcontrol is not at all unknown to windows developers. Microsoft included
this control from Visual Studio to Visual Studio.NET SDK to enhance developers
productivity and end users better experience. I agree that our windows
development must flow some standard to give better user experience. Here I am
trying to give little more enhancement on control appearance if and only if
developer want to do it.
This article is small in size and can apply in your different application
only if it must be a winform development. You can refer this article to update
your tab control's appearances in your parent window.
By default or through any properties the existing VS.NET SDK won't support
features which will enhance the appearances of tab pages like changing font
appearances , color,caption back color etc. Here what I am trying to do is ,
override a little and got into solution. So you can use this idea to enhance
your product or project.
If you feel this is good then don't forget to vote and give put your
If you check the property list of tabcontrol. You will came to to about
DrawMode property decides that how
tabpages are drawn in your application. If you check the values then you will
came to that there is two values are there which is assignable for the property
This enumerated value will specify that operating system will decide to draw
on behalf of developers.
This enumerated value will specify that developer is responsible for drawing
the appearance of tab page.
Suppose if you want to draw by yourself then you need to define event handler
Here also I am doing the same thing. Suppose it you want to change the
appearance of tabpage of any tabcontrol then you need to set
DrawMode property to
- Override the
DrawItem event handler definition.
private void tabControl1_DrawItem(object sender,
if(e.Index == this.tabControl1.SelectedIndex)
f = new Font(e.Font, FontStyle.Bold | FontStyle.Bold);
f = new Font(e.Font,FontStyle.Bold);
backBrush = new System.Drawing.SolidBrush(Color.DarkGray);
foreBrush = Brushes.White;
f = e.Font;
backBrush = new SolidBrush(e.BackColor);
foreBrush = new SolidBrush(e.ForeColor);
string tabName = this.tabControl1.TabPages[e.Index].Text;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
Full source code with an example is given with this article.
He is a certified professional in both MCPD and MCTS. He is a mathematics graduate with masters in computer science.He was born and bred in India and happen to spend some time in Europe.