本文整理汇总了C#中System.Windows.Forms.ToolStripMenuItem类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripMenuItem类的具体用法?C# ToolStripMenuItem怎么用?C# ToolStripMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripMenuItem类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripMenuItem类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: foreach
// Distinguish the merged items by setting the shortcut display string.
foreach (ToolStripMenuItem tsmi in cmsItemsToMerge.Items)
{
tsmi.ShortcutKeyDisplayString = "Merged Item";
}
示例2: new ToolStripMenuItem
//引入命名空间
using System;
using System.Windows.Forms;
class StripMenuForm : Form {
MenuStrip MyMenu;
public StripMenuForm() {
Text = "Use a MenuStrip";
MyMenu = new MenuStrip();
// Add top-level menu items to the menu.
ToolStripMenuItem m1 = new ToolStripMenuItem("File");
MyMenu.Items.Add(m1);
ToolStripMenuItem m2 = new ToolStripMenuItem("Tools");
MyMenu.Items.Add(m2);
ToolStripMenuItem subm1 = new ToolStripMenuItem("Open");
m1.DropDownItems.Add(subm1);
ToolStripMenuItem subm2 = new ToolStripMenuItem("Close");
m1.DropDownItems.Add(subm2);
ToolStripMenuItem subm3 = new ToolStripMenuItem("Exit");
m1.DropDownItems.Add(subm3);
ToolStripMenuItem subm4 = new ToolStripMenuItem("Coordinates");
m2.DropDownItems.Add(subm4);
ToolStripMenuItem subm5 = new ToolStripMenuItem("Change Size");
m2.DropDownItems.Add(subm5);
ToolStripMenuItem subm6 = new ToolStripMenuItem("Restore");
m2.DropDownItems.Add(subm6);
subm3.Click += MMExitClick;
Controls.Add(MyMenu);
// Assign the menu to the form.
MainMenuStrip = MyMenu;
}
[STAThread]
public static void Main() {
StripMenuForm skel = new StripMenuForm();
// Enable visual styles for Windows XP.
Application.EnableVisualStyles();
Application.Run(skel);
}
protected void MMExitClick(object who, EventArgs e) {
}
}