简体   繁体   English

Delphi:在TCoolBar中设置TMainMenu和TToolBar的样式

[英]Delphi: Styled TMainMenu and TToolBar in TCoolBar

I'm attempting to create an application menu and toolbar in Delphi XE3 that looks like the following (from a program I have): 我试图在Delphi XE3中创建一个应用程序菜单和工具栏,如下所示(从我拥有的程序中):

TCoolBar中的主菜单和工具栏

I'm able to replicate a portion of this look by doing the following: 通过执行以下操作,我可以复制此外观的一部分:

  1. Create a new VCL Forms application 创建一个新的VCL Forms应用程序
  2. Add a TMainMenu and insert template menus for File/Edit/etc. 添加一个TMainMenu并为文件/编辑/等插入模板菜单。
  3. Add a TCoolBar to the form TCoolBar添加到窗体
  4. Add a TToolBar to the TCoolBar TToolBar添加到TCoolBar
  5. Add a TToolButton to the TToolBar for each of File/Edit/etc. 为每个File / Edit / etc添加一个TToolButtonTToolBar and choose the Group property 并选择组属性
  6. Delete the Menu property from the form (so no program menu shows) 从窗体中删除Menu属性(因此不会显示程序菜单)
  7. Assign the MenuItem property for each TToolButton to the corresponding File/Edit/etc. 将每个TToolButton的MenuItem属性分配给相应的File / Edit / TToolButton
  8. Add a second TToolBar to the TCoolBar beneath the first one 将第二个TToolBar添加到第一个中的TCoolBar

Here's what it looks like: 看起来是这样的:

我在TCoolBar中的主菜单和工具栏

It's somewhat similar but is still missing all the style elements to modify the look of the new application menu. 它有些相似,但是仍然缺少所有样式元素来修改新应用程序菜单的外观。

My question is, does anyone know of how to achieve a similar look, perhaps with a third-party component library? 我的问题是,有没有人知道如何通过第三方组件库获得相似的外观? It seems likely that the original developer used a third-party VCL library. 原始开发人员似乎使用了第三方VCL库。 I'd like the drop shadow in addition to the styled menus and TCoolBar . 除了样式菜单和TCoolBar之外,我还想添加阴影。

I've tried Raize Components, TMS Advanced Toolbars & Menus, and am in the process of trying DevExpress VCL components. 我已经尝试过Raize Components,TMS Advanced Toolbars和Menus,并且正在尝试DevExpress VCL组件。 None of them seem to provide a solution, but perhaps I'm not familiar enough with them yet to figure it out. 他们似乎都没有提供解决方案,但也许我对他们还不了解,还没有找到解决方案。

Delphi has come with an ActionBands demo that can show you how to obtain this appearance "out of the box" for your menus using TActionMainMenuBar (and TActionToolBar ). Delphi附带了一个ActionBands演示,该演示可以向您展示如何使用TActionMainMenuBar (和TActionToolBar )为菜单获得“现成的”外观。 Just change the Style menu to XP Style in the demo: 只需在演示中将“ Style菜单更改为“ XP Style ”:

ActionBand演示

The rest of your steps seem pretty well complete. 您的其余步骤似乎都已经完成。 For the images on the menu items and toolbar buttons, see the use of ImageList components in association with the TActions on the menu and toolbar in the demo. 有关菜单项和工具栏按钮上的图像,请参见结合使用ImageList组件和演示中菜单和工具栏上的TActions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM