0

I have a Windows Forms application with a MenuStrip. BackColor is blue, but when the window is resized (in the image you see only left corner of the menu) and I want to display other hidden items, the background is not blue.

How can I change the background color?

enter image description here

mare.zim
  • 199
  • 3
  • 12

1 Answers1

1

Check out this : ToolStripProfessionalRenderer

public class MyToolStripRenderer : ToolStripProfessionalRenderer
{
    /* override styling/drawing here */
}

MenuStrip strip = new MenuStrip();

strip.Renderer = new MyToolStripRenderer();

//this will set RenderMode to "Custom"

Exemple :

public  class TestColorTable : ProfessionalColorTable
{
    public override Color MenuItemSelected
    {
        get { return Color.Red; }
    }

    public override Color MenuBorder  //added for changing the menu border
    {
        get { return Color.Green; }
    }

You would use it like this:

private void Form1_Load(object sender, EventArgs e)
{
    menuStrip1.Renderer = new ToolStripProfessionalRenderer(new TestColorTable());
}
napi15
  • 2,354
  • 2
  • 31
  • 55