views:

2931

answers:

4

These days with Visual C# (Visual C# 2008 specifically) it seems that the default color for menustrips and menus is blue, which to me looks really strange and is something that I'd really like to override. I'm guessing that Visual Studio is picking up this blue color from my selected system theme or something, however no other Windows app running on my system has this blue color so I don't know why my .NET apps would have to have it. ;)

Anyway, I noticed that if I create an application using an older version of Visual Studio (Visual Studio.NET), the default background color for menustrips and menus is the standard gray that you'd expect to see. This is one solution to the problem I suppose, but it seems like kind of a stupid one and I'd really like to find a way to override it in the current version of Visual C#.

A: 

Have you tried setting the back color of your menuStrip? You should be able to do something like:

this.menuStrip1.BackColor = Color.FromKnownColor(KnownColor.Control);
BFree
That works for the menustrip, but not for the gradient on the menus or for the highlight color on the menustrip.
Jason Roberts
A: 

DotNet 1.x didn't have a MenuStrip, and used a standard Windows menu.

DotNet versions 2.0 and up have the MenuStrip, and VS 7 and up removes the MainMenu from the toolbox and replaces it with a MenuStrip, which uses the Office Xp 2003 theme, hence the blue color scheme for the MenuStrip and ToolStrip.

The MainMenu can still be added to the toolbox for a standard Windows menu.

Snarfblam
Okay, now it all makes sense. Thanks for the explanation.
Jason Roberts
A: 

Set the "RenderMode" option of the MenuStrip to "System" instead of "managerRenderMode"

:)

A: 

You can use the render mode but that only sets the system theme to default. .net allows you to change the backcolor and the for color but when you hover over it It still shows the default colors. Heres a way around that...

his is very simple to accomplish by using the "DropDownOpening" , "DropDownClosed", and "MouseEnter" events.

private void fileToolStripMenuItem_DropDownOpening(object sender, EventArgs e){

 // When the user clicks on "File" it will change to red.
 fileToolStripMenuItem.ForeColor = Color.Red;

}

private void testToolStripMenuItem_MouseEnter(object sender, EventArgs e){

 // When the user hovers over a child of "file" called "test", "file" turns orange.
 fileToolStripMenuItem.ForeColor = Color.Orange;

}

private void test2ToolStripMenuItem_MouseEnter(object sender, EventArgs e){

 // When the user hovers on a child of "file" called "test2", "file" turns blue.
 fileToolStripMenuItem.ForeColor = Color.Blue;

}

private void fileToolStripMenuItem_DropDownClosed(object sender, EventArgs e){

 // When the user leaves the "file" menu, it gets restored back to black.
 fileToolStripMenuItem.ForeColor = Color.Black;

}