用MainMenu.MenuItems.Add方法可以增加菜单啊private void InitializeMyMainMenu()
{
// Create the MainMenu and the MenuItem to add.
MainMenu mainMenu1 = new MainMenu();
MenuItem menuItem1 = new MenuItem("&File");
/* Use the MenuItems property to call the Add method
0A to add the MenuItem to the MainMenu menu item collection. */
mainMenu1.MenuItems.Add (menuItem1); // Assign mainMenu1 to the form.
this.Menu = mainMenu1;
}
{
// Create the MainMenu and the MenuItem to add.
MainMenu mainMenu1 = new MainMenu();
MenuItem menuItem1 = new MenuItem("&File");
/* Use the MenuItems property to call the Add method
0A to add the MenuItem to the MainMenu menu item collection. */
mainMenu1.MenuItems.Add (menuItem1); // Assign mainMenu1 to the form.
this.Menu = mainMenu1;
}
从配置文件中读出来数据一个一个加
----------------------------------------
欢迎光临:C#资源网
http://csource.yeah.net
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsmenumenuitemcollectionclassaddtopic.asp在上面的链接中给出了一个简单的示例。您还可以在MSDN中找到一个更详尽的示例:
http://samples.gotdotnet.com/quickstart/aspplus/default.aspx?url=/quickstart/winforms/doc/WinFormsMenus.aspx
- 微软全球技术中心 VC技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。