Dhruv Jain

Dhruv Jain

  • NA
  • 6
  • 4.4k

Changing the menu color

Sep 22 2012 4:54 AM
I wished to have menu items with different background.I searched google and came across the following code.It worked!!!
Can anybody explain it to me thoroughly


public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        menuStrip1.Renderer = new MyRenderer();
    }

    private class MyRenderer : ToolStripProfessionalRenderer {
        public MyRenderer() : base(new MyColors()) {}
    }

    private class MyColors : ProfessionalColorTable {
        public override Color MenuItemSelected {
            get { return Color.Yellow; }
        }
        public override Color MenuItemSelectedGradientBegin {
            get { return Color.Orange; }
        }
        public override Color MenuItemSelectedGradientEnd {
            get { return Color.Yellow; }
        }
    }
}