Scenes
In the context menu to add a sub-menu options can ContextMenuStrip by
ContextMenuStrip menuStrip MnuChartOption the ToolStripMenuItem = new new the ToolStripMenuItem (); // New menu item object mnuChartOption.Name = " chart_option " ; mnuChartOption.Text = " Graph option " ; // Click on the Options dialog box pop-up graphics mnuChartOption.Click + = delegate ( Object SENDER, EventArgs E) { }; menuStrip.Items.Add(mnuChartOption);
to realise. But if we add a submenu option in the context menu under the submenu options, the formation of two sub-menus.
Note:
Blog home page:
https://blog.csdn.net/badao_liumang_qizhi
public concern number
overbearing program ape
acquisition-related programming e-books, tutorials and free downloads push
achieve
ToolStripMenuItem sub-level menu is still ToolStripMenuItem, mainly to build relationships through DropDownItems property.
Construction of two right submenu Sample Code
= MnuDirectPrint the ToolStripMenuItem new new the ToolStripMenuItem ( " direct printing " ); mnuDirectPrint.Name = "directPrint"; mnuDirectPrint.Text = " direct print " ; mnuDirectPrint.Click += delegate(object sender, EventArgs e) { control.DoPrint (); }; MnuPrintPageSet ToolStripMenuItem = new new ToolStripMenuItem ( " Print Page Setup " ); mnuPrintPageSet.Name = "printPageSet"; mnuPrintPageSet.Text = " Print Page Setup " ; mnuPrintPageSet.Click += delegate(object sender, EventArgs e) { control.DoPageSetup(); }; ToolStripMenuItem mnuPrint = new ToolStripMenuItem(); mnuPrint.Name = "mnuPrint"; mnuPrint.Text = " Print " ; mnuPrint.DropDownItems.Add(mnuDirectPrint); mnuPrint.DropDownItems.Add(mnuPrintPageSet); menuStrip.Items.Add(mnuPrint);
effect