public class MenuColorTable : ProfessionalColorTable
{
public MenuColorTable()
{
UseSystemColors = false;
}
public override Color MenuBorder
{
get { return Color.Fuchsia; }
}
public override Color MenuItemBorder
{
get { return Color.DarkViolet; }
}
public override Color MenuItemSelected
{
get { return Color.Cornsilk; }
}
public override Color MenuItemSelectedGradientBegin
{
get { return Color.LawnGreen; }
}
public override Color MenuItemSelectedGradientEnd
{
get { return Color.MediumSeaGreen; }
}
public override Color MenuStripGradientBegin
{
get { return Color.AliceBlue; }
}
public override Color MenuStripGradientEnd
{
get { return Color.DodgerBlue; }
}
}
变更Renderer:
contextMenuStrip1.Renderer = new ToolStripProfessionalRenderer(new MenuColorTable());
1条答案
按热度按时间qvtsj1bj1#
可以创建自定义颜色表并更改渲染器属性:
变更
Renderer
:结果如下: