简体   繁体   中英

How to remove a specific context menu item in Zedgraph

I want to remove a specific context menu item, appears when the Mouse down(right) event is fired.

在此处输入图片说明

with the help of Context Menu Builder event, I was able to add some costume menu items, but I want to get rid off the last item(Default).

Thanks in advance...

In the same event handler, you can remove items as well, for example:

private void zedGraphControl1_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
{
  foreach (ToolStripMenuItem item in menuStrip.Items)
  {
    if ((string)item.Tag == "set_default")
    {
      menuStrip.Items.Remove(item);
      break;
    }
  }
}

Relevant Link: http://goorman.free.fr/ZedGraph/zedgraph.org/wiki/index43d0.html?title=Edit_the_Context_Menu

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