Search code examples
c#winformsmenustriptoolstripmenu

Disable ToolStripMenuItem highlight?


I have an application with a MenuStrip and every time I hover my mouse over a MenuItem, it highlights blue.

I have tried to change the BackColor and ForeColor but that wasn't the problem.

Is there a way to disable this?


Solution

  • This would be incredibly un-useful to the end user:

    internal class NoHighlightRenderer : ToolStripProfessionalRenderer {
      protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) {
        if (e.Item.OwnerItem == null) {
          base.OnRenderMenuItemBackground(e);
        }
      }
    }
    

    Then apply it to your MenuStrip:

    menuStrip1.Renderer = new NoHighlightRenderer();