如何向 FireMonkey 工具栏添加按钮?
凭借 10 年的开发经验,我无法在 FireMonkey 工具栏上添加新按钮。有人可以帮助我吗?
With 10 years of experience in development, I could not put new buttons on the Toolbar FireMonkey. Could anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有组件编辑器菜单项来添加按钮或分隔符,但您可以将按钮从工具托盘拖动到工具栏。或者选择表单中的工具栏并按F6。在工具栏上键入所需控件的名称,然后按 Enter 键。
There is no component editor menu-item to add buttons or seperators, but you can drag buttons from the toolpallet to the toolbar. Or select the toolbar in the form and press F6. Type the name of the control you want on the toolbar and press enter.
TToolBar
现在只是一个容器。您必须将自己的控件放到它上面。要将控件添加到工具栏,请确保在窗体上选择了工具栏,在工具选项板中选择子控件,然后单击工具栏中希望子控件出现的位置。
另一种方法是确保选择工具栏并双击工具选项板中的控件。无论选择什么控件都会成为父控件。
许多新的 FireMonkey UI 控件现在只是容器,包括
TStatusBar
。要向
TStatusBar
添加文本行,您必须添加自己的TLabel
或其他控件。我发现将图像放在按钮上的最佳方法是将
TImage
直接放到按钮上并取消设置TImage
的HitTest
财产。所有 FireMonkey 控件都是容器,现在可以有子控件。配置 UI 可能需要更长的时间,但您有很大的灵活性。
使用
TLayout
控件来划分父控件并对齐控件。使用Margin
和Padding
属性来调整间距。TToolBar
is now simply a container. You must drop your own controls onto it.To add a control to a ToolBar, make sure that your ToolBar is selected on the form, select your child control in the Tool Palette, and then click the location in the ToolBar that you wish your child control to appear.
Another way to do this is to ensure that the ToolBar is selected and double-click the control in the Tool Palette. Whatever control is selected becomes the parent.
Many of the new FireMonkey UI controls are now simply containers, including
TStatusBar
.To add a text line to
TStatusBar
, you must add your ownTLabel
or other control.I found that the best way to put an image on a button was to literally drop a
TImage
onto the button and unset theTImage
'sHitTest
property.All FireMonkey controls are containers and can have child controls now. It might take a little longer to configure your UI, but you have a lot of flexibility.
Use the
TLayout
control for dividing up the parent control and aligning your controls. Use theMargin
andPadding
properties to adjust the spacing.