Reputation: 23
I have MenuStrip with 2 buttons. When I click one of them the color changes to white.
Not clicked
Clicked
How can I change the color of the clicked button when selected?
Upvotes: 1
Views: 1012
Reputation: 81610
You need to supply your own Renderer:
public class RendererEx : ToolStripProfessionalRenderer {
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) {
//base.OnRenderMenuItemBackground(e);
e.Item.BackColor = Color.Black;
}
}
Then apply it in the form's constructor:
menuStrip1.Renderer = new RendererEx();
Upvotes: 1