简体   繁体   中英

Disable toolstripmenuitem highlight?

I have an application with a menustrip and everytime i hover mij mouse over an menuitem it highlights blue. I have tried to change the backcolor and forcolor but tat wasn't the problem. Is there a way to disable this?

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();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM