本文整理汇总了C#中System.Windows.Forms.Menu.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.AddRange方法的具体用法?C# Menu.AddRange怎么用?C# Menu.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Menu
的用法示例。
在下文中一共展示了Menu.AddRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddControlMenuItems
public static void AddControlMenuItems(Menu.MenuItemCollection pParent, AemInstance pInstance)
{
List<MenuItem> menuItems = new List<MenuItem>();
MenuItem item;
item = new MenuItem();
item.Text = "Start instance";
item.Click += new EventHandler(ControlStartInstance);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Stop instance";
item.Click += new EventHandler(ControlStopInstance);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Kill instance";
item.Click += new EventHandler(ControlKillInstance);
menuItems.Add(item);
foreach (MenuItem i in menuItems) {
i.Tag = pInstance;
}
pParent.AddRange(menuItems.ToArray());
}
示例2: AddOpenMenuItems
public static void AddOpenMenuItems(Menu.MenuItemCollection pParent, AemInstance pInstance, bool pSetDefaultItem)
{
List<MenuItem> menuItems = new List<MenuItem>();
MenuItem item;
item = new MenuItem();
item.Text = "Open Author/Publish";
item.Click += new EventHandler(OpenAuthorPublish);
if (pSetDefaultItem) {
item.DefaultItem = true;
}
menuItems.Add(item);
item = new MenuItem();
item.Text = "Open CRX";
item.Click += new EventHandler(OpenCRX);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Open CRXDE Lite";
item.Click += new EventHandler(OpenCRXDELite);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Open Felix Console";
item.Click += new EventHandler(OpenFelixConsole);
menuItems.Add(item);
item = new MenuItem();
item.Text = "Open Folder";
item.Click += new EventHandler(OpenFolder);
menuItems.Add(item);
if (pInstance.AemInstanceType == AemInstanceType.AEM54) {
item = new MenuItem();
item.Text = "Open Servlet Engine Admin";
item.Click += new EventHandler(OpenServletEngineAdmin);
menuItems.Add(item);
}
foreach (MenuItem i in menuItems) {
i.Tag = pInstance;
}
pParent.AddRange(menuItems.ToArray());
}
示例3: AddLogMenuItems
public static void AddLogMenuItems(Menu.MenuItemCollection pParent, AemInstance pInstance)
{
List<MenuItem> menuItems = new List<MenuItem>();
MenuItem item;
// show dynamic list of current logfiles
item = new MenuItem();
item.Text = "Open logfile...";
item.Popup += LogFilesItem_Popup;
item.MenuItems.Add(new MenuItem("-- No logfiles --"));
menuItems.Add(item);
item = new MenuItem();
item.Text = "Console window";
item.Click += new EventHandler(ShowConsoleWindow);
menuItems.Add(item);
foreach (MenuItem i in menuItems) {
i.Tag = pInstance;
}
pParent.AddRange(menuItems.ToArray());
}