Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

enter image description here

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...

like image 539
SanVEE Avatar asked Jul 05 '12 09:07

SanVEE


1 Answers

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

like image 107
PeskyGnat Avatar answered Sep 20 '22 04:09

PeskyGnat