0

I'm making a winform application and think it'd benefit greatly from the Ribbon UI element. Is it possible to put a ribbon on my own application? If so, how?

I'm hoping to not rely on 3rd-party tools like Delphi because then my application will quickly look outdated in future (or maybe even current) versions of Windows. I know this because I was looking at Creating Ribbon Styled Applications and noticed that it still looks like Office 2007, even though it's being compared against WordPad in Windows 7 which uses the Office 2010 visual style, presumably on the same machine. Even now, MS Windows 8 applications use the Office 2013 styles in Explorer, WordPad, Paint, etc, and I can't see any evidence of Delphi yet supporting that visual style, or that it would adapt its style to older platforms like Vista when necessary. Sorry if this is too nitpicky, but I prefer to give my users the experience they're used to, not my own or a future one.

4

2 回答 2

2

如果您打算为您的用户提供“最原始的外观”,您应该坚持使用 Windows 功能区框架。这是因为 Microsoft 也将此 API 用于其“默认”Windows 功能区应用程序(MS Word、MS Paint)。这种“本机”实现的优点是(因此此列表并不详尽):

  • Look'n'feel 以操作系统为导向。这意味着您的 Ribbon 应用程序看起来与 Windows 7 和 8 上的 MS Paint 和 MS Wordpad 完全相同。这样,您的应用程序的功能区也将直接受益于 Microsoft 在未来的 Windows 更新和 - 当然 - Windows 版本中为 Windows 功能区框架提供的改进/补丁。

  • 不需要其他软件(Windows Vista / Server 2008 除外,它需要平台更新以支持 Windows 功能区框架)。

  • COM API,功能区 GUI 因此可以集成到 Windows 上支持 COM 编程(.NET、C++、Delphi 等)的任何编程语言的应用程序中。

Microsoft 提供了其他几个功能区实现(在参考您的描述时是第一方),但所有这些实现都是针对特定软件(Office 功能区)或平台(WPF 功能区)实施的,或者只是过时的(MFC 功能区) . Office 功能区不适合您,因为这些功能当然仅限于 Microsoft Office 应用程序。MFC Ribbons 也是基于 COM 的,因此理论上可以使用它们。但如前所述,它们已经过时,因此您的应用程序看起来像 Of​​fice 2007 的后代。WPF 绝对是一种选择,因为:

  • 这些组件非常强大,并且 WPF 组件正在积极更新/维护。

  • 从开发人员的角度来看,它们更容易集成到应用程序中,因为有很多文档,并且组件得到了 Visual Studio 等常见 IDE 的良好支持。

  • 安装 .NET 框架后,功能区甚至可以在“过时”的操作系统上使用,例如 Windows XP。如果您仍然需要支持 Windows XP / 2003,这是您应该牢记的。

但如前所述,这些与 Microsoft 用于其“默认”功能区应用程序的组件不同,因此与 Windows 功能区框架相比,它们看起来总是有些不同。

因此,如果您决定坚持使用 Windows 功能区框架,您现在可以决定是否“硬核”并自行实现所需的接口,或者您可以使用现有的包装器,例如“ Windows Ribbon for WinForms ”或“ Delphi 的 Windows 功能区框架"。请务必将 Delphi 称为“第三方工具”。我猜那是因为你看到了Embarcadero 提供的 Ribbon 组件(德尔福出版商)。正确的是,这些已经严重过时,看起来像狗屎并且不再积极维护(和错误,并且......)。所以不要使用它们。而是直接使用 Windows 功能区框架。我上面提到的包装器就是这样做的,它只是极大地简化了开发过程,因为它实现了所有必需的接口,带有一个设计器和一些示例应用程序。

如果您想使用不同的编程语言,这也没有问题。我首先提到Delphi的原因只是因为您在原始帖子中写过并且包装器非常好。如前所述,您也可以使用任何其他支持 COM API 编程的编程。

我希望这能让事情更清楚一些。[向那些来到这里的人致敬!;)]

PS:我没有提到诸如 DevExpress 或 TMS 之类的实际 3rd 方实现,因为无论如何您都想坚持使用 Microsoft 实现。

于 2014-09-04T19:39:40.663 回答
1

我不确定你是如何定义“第三方工具”的,但是这个代码项目使用了 codeplex 上的一个库,它很好地支持了 office 10 和 office 13 风格。

以下是一些屏幕截图供您品尝(来自codeplex官方网站的副本):

2007年

2007年

2010

2010

2013

2013

于 2014-09-03T19:45:53.083 回答