G
Guest
I have one tab control with 5 tab pages.
I want to color each tab page a different color.
Does anyone know how to color the entire tab page a unique color?
(that includes the tab part of the tab page)
In other words, just like different paper folders come in different colors,
how do you program this?
If you look at the code I got from Microsoft, this will color only one tab
and put text on only one tab:
HOw does one do it when you have 5 tab pages with one tab control?
tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
....
....
tabControl1.DrawItem += new DrawItemEventHandler(DrawOnTab);
....
....
private void DrawOnTab(object sender, DrawItemEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Blue);
Font font = new Font("Arial", 10.0f);
SolidBrush brush = new SolidBrush(Color.Red);
SolidBrush brush1 = new
SolidBrush(Color.Beige);
g.DrawRectangle(p, tabArea);
g.DrawString("tabPage1",font,brush,tabTextArea);
}
I want to color each tab page a different color.
Does anyone know how to color the entire tab page a unique color?
(that includes the tab part of the tab page)
In other words, just like different paper folders come in different colors,
how do you program this?
If you look at the code I got from Microsoft, this will color only one tab
and put text on only one tab:
HOw does one do it when you have 5 tab pages with one tab control?
tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
....
....
tabControl1.DrawItem += new DrawItemEventHandler(DrawOnTab);
....
....
private void DrawOnTab(object sender, DrawItemEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Blue);
Font font = new Font("Arial", 10.0f);
SolidBrush brush = new SolidBrush(Color.Red);
SolidBrush brush1 = new
SolidBrush(Color.Beige);
g.DrawRectangle(p, tabArea);
g.DrawString("tabPage1",font,brush,tabTextArea);
}