C#菜单的子菜单的添加只有AddRange方法吗?
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5,
this.menuItem6,
this.menuItem7});
this.menuItem2.Text = "编辑 ";
只有这些方法吗?
------解决方案--------------------Add
Insert
都可以的啊.
------解决方案--------------------比如:
MainMenu mainMenu1 = new MainMenu();
MenuItem menuItem1 = new MenuItem( "&File ");
MenuItem menuItem2= new MenuItem( "&File1 ");
mainMenu1.MenuItems.Add(menuItem1);
IList i = (IList)mainMenu1.MenuItems;
i.Insert(1, menuItem2);
------解决方案--------------------up