前任
|Tab1|Tab2|Tab3| { }
| |
| |
| |
| |
|_____________________|
我可以更改 .. 的backcolor
and forecolor
,Tab
但我想更改 { } 的颜色 --> 空白空间是否可以这样做。..它显示默认的winforms颜色..帮助我在dis..
private void Form1_Load(object sender, EventArgs e)
{
}
private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
Font fntTab;
Brush bshBack;
Brush bshFore;
if ( e.Index == this.tabControl1.SelectedIndex)
{
fntTab = new Font(e.Font, FontStyle.Bold);
bshBack = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, SystemColors.Control, SystemColors.Control, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
bshFore = Brushes.Black;
//bshBack = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.LightSkyBlue , Color.LightGreen, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
//bshFore = Brushes.Blue;
}
else
{
fntTab = e.Font;
bshBack = new SolidBrush(Color.Red);
bshFore = new SolidBrush(Color.Aqua);
//bshBack = new SolidBrush(Color.White);
//bshFore = new SolidBrush(Color.Black);
}
string tabName = this.tabControl1.TabPages[e.Index].Text;
StringFormat sftTab = new StringFormat();
e.Graphics.FillRectangle(bshBack, e.Bounds);
Rectangle recTab = e.Bounds;
recTab = new Rectangle( recTab.X, recTab.Y + 4, recTab.Width, recTab.Height - 4);
e.Graphics.DrawString(tabName, fntTab, bshFore, recTab, sftTab);
}