本文整理汇总了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";
}
开发者ID:.NET开发者,项目名称:System.Windows.Forms,代码行数:5,代码来源:ToolStripMenuItem
示例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) {
}
}
开发者ID:C#程序员,项目名称:System.Windows.Forms,代码行数:58,代码来源:ToolStripMenuItem
注:本文中的System.Windows.Forms.ToolStripMenuItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论