Windows窗体中的本机外观(类似于浏览器的主菜单) [英] Native look (explorer-like) main menu in Windows Forms

查看:69
本文介绍了Windows窗体中的本机外观(类似于浏览器的主菜单)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了使用MenuStrip之外,还有其他方法可以在C#中创建主菜单吗?

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.

推荐答案

听起来好像您想要一个符合os主题的菜单. MainMenu类将执行此操作.

It sounds like you want a menu that respects the os theme. The MainMenu class will do this.

右键单击工具箱,然后选择选择项目".选择MainMenu类以将其添加到您的工具箱(当您选择选择项时,它将添加到打开"的类别下).

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).

请注意,MainMenu是从Component而不是Control派生的,因此将不具有完整的控制功能,并且与从Toolstrip派生的项目api相比,该api有点笨拙.

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.

请注意,如果您还希望这些控件的版本符合os的外观,则可以使用其他类替换上下文菜单,工具栏和状态栏的"strip"控件系列.也可以按照上述方式将它们添加到工具箱中.

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.

这篇关于Windows窗体中的本机外观(类似于浏览器的主菜单)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆