FireMonkey 中如何使用边距和填充?

发布于 2024-12-05 01:29:29 字数 143 浏览 3 评论 0原文

有谁知道如何使用边距和填充字段?

显然它们可以用来代替 Anchors,因为 FM 不支持 Anchors。今天早上我一直在和他们玩耍,但无法让他们按照我想要的方式行事。例如,我希望将两个按钮固定在表单的右侧和底部,以便在调整表单大小时按钮随表单一起移动。

Does anyone know how to use the Margin and Padding fields?

Apparently they can be used in place of Anchors, since FM doesn't support Anchors. I've been playing around with them this morning but couldn't get them to act in the way I wanted. eg, I would like two buttons to be anchored to the right and bottom of a form so that when the form is resized the buttons move with the form.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

网名女生简单气质 2024-12-12 01:29:29

要执行您想要的操作,请在窗体上放置一个 TLayout 并将其对齐方式设置为“底部”。在里面,您可以放置​​您想要的两个按钮。

将布局的高度设置为按钮的高度加上您希望按钮距表单边缘的任何边距。假设要与窗体底部和右侧保持 10 像素的距离,并且一个按钮高 25 像素,则布局的高度为 35。

将布局的右侧和底部边距设置为 10,然后设置最右边的按钮对齐到“右”。给最右边的按钮一个左内边距,例如 15,现在也将另一个按钮的对齐方式设置为“右”。现在,按钮在布局中右对齐,布局与表单底部对齐。实际上,按钮将保留在右下角或表单中。

                                         #
                                         #
 -------+--------+------------------+----#
        |        |H=25 (Button)     |    #H=35 (Layout)
        |   15   |                  | 10 #
 -------+ padd.  +------------------+    #
                 10 bot layout mrgn      #
 #########################################

To do what you want, place a TLayout on your form and set its alignment to "bottom". Inside, you can place the two buttons you want to have.

Set the height of the Layout to the height of the buttons plus any margin you want the buttons to have from the edge of the form. Assume you want to stay 10 pixels away from the bottom and the right of the form, and a button is 25 pixels high, then the height of the layout is 35.

Set the right and bottom margin of the layout to 10, and then set the alignment of the rightmost button to "right". Give the rightmost button a left padding of, say, 15, and now set the alignment of the other button to "right" too. Now the buttons are right aligned in the layout, and the layout is bottom aligned to the form. In effect, the buttons will stay in the bottom right corner or the form.

                                         #
                                         #
 -------+--------+------------------+----#
        |        |H=25 (Button)     |    #H=35 (Layout)
        |   15   |                  | 10 #
 -------+ padd.  +------------------+    #
                 10 bot layout mrgn      #
 #########################################
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文