如何向现有 MFC 应用程序添加功能区菜单?
Microsoft Visual C++ 2008 功能包具有功能区菜单支持。 是否可以在不是使用功能区菜单创建的现有 MFC 应用程序中使用它?
Microsoft Visual C++ 2008 Feature Pack has ribbon menu support. Is it possible to make use of that in an existing MFC application that was not created with a ribbon menu?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然可以采用现有的 MFC 应用程序并将其更新为使用 MFC 功能包中的功能区,并且我自己已经完成了此操作。
MSDN 上有几篇演练文章此处展示了如何操作使用您可能熟悉的 Scribble MFC 示例应用程序。
本质上,您需要做的就是更改代码以使用功能包基类而不是标准 MFC 基类 - 例如,将
CWinApp
替换为CWinAppEx
,< code>CFrameWnd 和CFrameWndEx
等。然后您可以将CMFCRibbonBar
和CMFCRibbonApplicationButton
对象添加到主窗口类中以创建功能区本身。 首先,我建议下载 Scribble 示例并遵循演练文章。我希望这有帮助!
It certainly is possible to take an existing MFC application and update it to use the ribbon in the MFC Feature Pack, and I've done this myself.
There are a couple of walkthrough articles on MSDN here that show how to do it, using the Scribble MFC sample application that you may be familiar with.
In essence, what you need to do is change your code to use the Feature Pack base classes instead of the standard MFC base classes - for example, replace
CWinApp
withCWinAppEx
,CFrameWnd
withCFrameWndEx
, etc. Then you can addCMFCRibbonBar
andCMFCRibbonApplicationButton
objects to your main window class to create the ribbon itself. To get started I'd suggest downloading the Scribble sample and following the walkthough articles.I hope this helps!
除了 ChrisN 指出的资源之外,我还建议创建一个新的 MFC 应用程序,其中包含功能区并检查生成的代码。
In addition to the resources pointed out by ChrisN, I recommend creating a new MFC application that includes a ribbon and examining the generated code..
是的,当然可以使用 MFC 功能包提供的功能区类。
此处提供了基本介绍: MFC 新功能快速浏览和更详细的教程可以在这里找到:MFC 功能包教程。
但是,请注意,它附带了相当严格的许可证。 有关条件,请参阅 授权 2007 Microsoft Office 用户界面 和此
Yes, it is surely possible to use the ribbon classes provided with the MFC Feature Pack.
A basic introduction is available here: Quick Tour Of New MFC Functionality and a more detailed tutorial can be found here: MFC Feature Pack Tutorial.
However, be aware that there is a rather strict license attached to it. For the conditions see Licensing the 2007 Microsoft Office User Interface and this related discussion on SO.