65.9K
CodeProject is changing. Read more.
Home

Selected TabPage style in Winform Tab Control

Feb 17, 2004

viewsIcon

131076

downloadIcon

3988

In winform application, we can change the selected tab page style using DrawItem event in tabcontrol

Sample Image - SelectedTabPage.jpg

Introduction

In winform application, TabControl doesn't have any property to change the Font style or Color. But we can change the selected tab page style using DrawItem event in tabcontrol programatically. See the below pictures for different styles.

Style 1:

You can give two color for Tab page in the following way.

bshBack = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds,
Color.LightSkyBlue , Color.LightGreen,
System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal); bshFore = Brushes.Blue;

Style1

Style 2:

Here I just change the font bold property.

Sample screenshot

Style 3

SelectedTabPage

In this way, we can apply any color or font to the Tab Controls and Tab Pages.

Conclusion

I think this article will help you to apply the colors and font to a tap pages and any help, comments are much appreciated!