how can I change toolstripmenuitem border color?

一笑奈何 提交于 2020-02-28 06:11:12

问题


I made a form like this (language c# - VisualStudio2012):
http://i.stack.imgur.com/5GEY1.jpg
How can I change the border color of toolstripmenuitem from white to another, or disable it ?
code:

class CustomProfessionalColors : ProfessionalColorTable
{
    public override Color MenuItemSelected
    { get { return Color.FromArgb(51, 51, 52); } }

    public override Color MenuBorder
    { get { return Color.Black; } }

    //fill màu item của menu khi mouse enter
    public override Color MenuItemSelectedGradientBegin
    { get { return Color.FromArgb(64, 64, 66); } }

    public override Color MenuItemSelectedGradientEnd
    { get { return Color.FromArgb(64, 64, 66); } }

    // chọn màu viền menu item khi mouse enter
    public override Color MenuItemBorder
    { get { return Color.FromArgb(51, 51, 52); } }

    // fill màu nút item của menu khi dc nhấn
    public override Color MenuItemPressedGradientBegin
    { get { return Color.FromArgb(27, 27, 28); } }

    public override Color MenuItemPressedGradientEnd
    { get { return Color.FromArgb(27, 27, 28); } }

    // fill màu thanh menu strip
    public override Color MenuStripGradientBegin
    { get { return Color.FromArgb(51, 51, 52); } }

    public override Color MenuStripGradientEnd       
    { get { return Color.FromArgb(51, 51, 52); } }
}

public Form1()
    {
        InitializeComponent();
        menuStrip1.Renderer = new ToolStripProfessionalRenderer(new CustomProfessionalColors());      
    }

回答1:


This will do the job. It's actually not a border, but a background.

public override Color ToolStripDropDownBackground {
    get { return Color.Red; }
}


来源:https://stackoverflow.com/questions/15207460/how-can-i-change-toolstripmenuitem-border-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!