Reputation: 219
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?
Upvotes: 0
Views: 114
Reputation: 2402
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());
}
Upvotes: 1