我正在尝试用rgb颜色填充标签和背景标签,就像这样
我想像右边那样做我的标签,它们都是一种颜色,
以下代码:
// Get the item from the collection.
TabPage _tabPage = tabControl1.TabPages[e.Index];
// Get the real bounds for the tab rectangle.
Rectangle _tabBounds = tabControl1.GetTabRect(e.Index);
if (e.State == DrawItemState.Selected)
{
// Draw a different background color, and don't paint a focus rectangle.
_textBrush = new SolidBrush(Color.FromArgb(255, 66,78,90));
g.FillRectangle(Brushes.Gray, e.Bounds);
}
else
{
_textBrush = new System.Drawing.SolidBrush(e.ForeColor);
e.DrawBackground();
}
我已将标签设置为绘制模式,我该如何实现目标?
答案 0 :(得分:0)
您可以更改选项卡的BackColor属性:
_tabPage.BackColor = Color.RoyalBlue;