问题
Is there another way to create the main menu in C# other than using MenuStrip?
It doesn't looks similar to standard Explorer menu.
Am I doing something wrong here? I just want the standard app main menu, like the explorer one.
回答1:
It sounds like you want a menu that respects the os theme. The MainMenu class will do this.
Right click on the toolbox and select "choose items". Select the MainMenu class to add it to your toolbox (it will be added under the category you were 'on' when you selected choose items).
Note that the MainMenu derives from Component rather than Control so will not have full control capabilities and the api is a little clunky compare to the Toolstrip derived items api.
Note that there are other classes that were replaced by the 'strip' family of controls for context menus, toolbars and statusbars if you want also want versions of those controls that respect the os look and feel. These can also be added to the toolbox in the manner described above.
回答2:
It sounds like what you want is to have the menu keep the look and feel of the current operating system's style. The MenuStrip
has a more generic look and feel to it, and requires styling. If you really want to keep the look and feel of the system menu, consider using MainMenu
instead.
Read More here: http://msdn.microsoft.com/en-us/library/system.windows.forms.mainmenu.aspx
来源:https://stackoverflow.com/questions/8748144/native-look-explorer-like-main-menu-in-windows-forms