如何更改TabControl颜色 [英] How do I change TabControl color
问题描述
如何更改标签控件背面颜色。它在图像上突出显示。
https://drive.google.com/open?id=0B2RsqtI-JTVxcHJEdnZJUjZpQzQ&authuser=0 [ ^ ]
我有更改标签颜色的代码,也许会有所帮助。
private void TabControl_DrawItem(对象发送者,DrawItemEventArgs e)
{
switch(e.Index)
{
case 0:
e.Graphics.FillRectangle(new SolidBrush(Color.Violet),e.Bounds);
休息;
案例1:
e.Graphics.FillRectangle(新的SolidBrush(Color.Blue),e .Bounds);
休息;
}
Rectang le PaddedBounds = e.Bounds;
PaddedBounds.Inflate(-2,-2);
e.Graphics.DrawString(TabControl.TabPages [e.Index] .Text ,this.Font,SystemBrushes.HighlightText,PaddedBounds);
}
How do I change tab control back color. It is highlighted on image.
https://drive.google.com/open?id=0B2RsqtI-JTVxcHJEdnZJUjZpQzQ&authuser=0[^]
I have a code for changing tab color, maybe it will help.
private void TabControl_DrawItem(object sender, DrawItemEventArgs e)
{
switch (e.Index)
{
case 0:
e.Graphics.FillRectangle(new SolidBrush(Color.Violet), e.Bounds);
break;
case 1:
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), e.Bounds);
break;
}
Rectangle PaddedBounds = e.Bounds;
PaddedBounds.Inflate(-2,-2);
e.Graphics.DrawString(TabControl.TabPages[e.Index].Text, this.Font, SystemBrushes.HighlightText, PaddedBounds);
}
推荐答案
我已经尝试了两种方法。没有他们帮助!
我刚刚将其模式更改为标准选项卡。在这种模式下,栏是白色的!
I have tried both already. Non of them helped!
I just changed its mode to standard tabs. In this mode that bar is white!
你好,
试试
http://www.c-sharpcorner.com/uploadfile/mahesh/c -sharp-tabcontrol / [ ^ ]
请看这个链接
http://stackoverflow.com/questions/5338587/set-tabpage-header-color [ ^ ]
一切都在这里解释
干杯!
Please see this link
http://stackoverflow.com/questions/5338587/set-tabpage-header-color[^]
everything explain here
Cheer!
这篇关于如何更改TabControl颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!