private void Zgc_contextmenubuilder (Zedgraphcontrol sender,
ContextMenuStrip MenuStrip, point mousept,
Zedgraphcontrol.contextmenuobjectstate objstate)
{
Try
{
#region//Remove unused keys
Remove the other menu options to change the Set_default to the corresponding string.
Title_def Title
Copy replication
Copied_to_clip Copy to Clipboard
Page_setup Page Setup ...
Print printing ...
Save_as Save Chart ...
Set_default Restore Default Size
Show_val Display node values
Unzoom Restore Zoom
UNPAN Restore Mobile
Undo_all Restore Zoom/move
X_title_def X-axis
Y_title_def Y-axis
Each loop can only traverse one key
foreach (ToolStripMenuItem item in Menustrip.items)
{
if (string) item. Tag = = "Set_default")//"Restore Default Size" menu item
{
MenuStrip.Items.Remove (item);//Remove menu item
Item. Visible = false; does not display
Break
}
}
foreach (ToolStripMenuItem item in Menustrip.items)
{
if (string) item. Tag = = "Copy")//"Copy" menu item
{
MenuStrip.Items.Remove (item);//Remove menu item
Item. Visible = false; does not display
Break
}
}
foreach (ToolStripMenuItem item in Menustrip.items)
{
if (string) item. Tag = = "Page_setup")//"Page Setup" menu item
{
MenuStrip.Items.Remove (item);//Remove menu item
Item. Visible = false; does not display
Break
}
}
foreach (ToolStripMenuItem item in Menustrip.items)
{
if (string) item. Tag = = "print")//"Printing" menu item
{
MenuStrip.Items.Remove (item);//Remove menu item
Item. Visible = false; does not display
Break
}
}
foreach (ToolStripMenuItem item in Menustrip.items)
{
if (string) item. Tag = = "Save_as")//"Save as" menu item
{
MenuStrip.Items.Remove (item);//Remove menu item
Item. Visible = false; does not display
Break
}
}
#endregion
}
catch (System.Exception ex)
{
MessageBox.Show ("Error code:112, Initialize right-click menu errors" + ex.) ToString ());
}
}
#endregion
* * If you do not need to display at all, use Zedcntrol.isshowcontextmenu = false;
Zedgraph Right-click menu How to disable it pop-up (go)