# VBForums CodeBank > CodeBank - C# >  Setting selected tabpage header text to bold.

## heuyen

```

tabControl1.DrawMode=TabDrawMode.OwnerDrawFixed;
tabControl1.Padding=new Point(15,5);
private void tabcontrol1_drawitem(object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			TabPage currentab=tabControl1.TabPages[e.Index];
			SolidBrush textbrush=new SolidBrush(Color.Black);
			Rectangle itemrect=tabControl1.GetTabRect(e.Index);
			StringFormat sf=new StringFormat();
			sf.Alignment=StringAlignment.Center;
			sf.LineAlignment=StringAlignment.Center;

			if(Convert.ToBoolean(e.State & DrawItemState.Selected))
			{
				Font f=new Font(tabControl1.Font.Name,tabControl1.Font.Size,FontStyle.Bold);
				e.Graphics.DrawString(currentab.Text,f,textbrush,itemrect,sf);
			}
			else e.Graphics.DrawString(currentab.Text,e.Font,textbrush,itemrect,sf);
			textbrush.Dispose();		
		}
```

Love to hear any comments. :Smilie:

----------


## The Surgeon

Fantastic code snippet... thanks so much.

----------


## gsforsyth

Looks good, but where do you place this code?

----------

