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?
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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.