Firemonkey / Delphi中的流体/动态布局 [英] Fluid/Dynamic layout in Firemonkey / Delphi

查看:193
本文介绍了Firemonkey / Delphi中的流体/动态布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想要一个并排的两个形状,正好占据每个窗口的50%,当窗口调整大小时调整大小。我该怎么做?



我真正想要的是设置比例..例如..有一个上述形状占25%,另一个占75%



动态调整大小非常重要,我不想输入任何代码来实现这一点。

解决方案

可以通过在表单上放置TLayout来实现 - 将对齐选项设置为alscale



然后为我的示例TPanels添加2个项目到TLayout Ie - 将对齐选项设置为alscale。将每个宽度设置为所需的比例。



创建时的形式:





Form On Resize:



可以使用'无代码 - '对于上面的图像,我刚添加了标签来显示面板宽度的大小。
希望这有助于
Paul


Let's say I want two shapes on a form sitting side by side taking up exactly 50% of the window each, which resize when the window is resized. How can I do that?

What I really want is to set things up in ratios.. eg.. Have one of the above shapes take up 25% and the other take 75%

The dynamic resizing is very important, and I don't want to have to type any code to achieve this.

解决方案

Can be achieved by dropping a TLayout on the form - Setting the Align option to 'alscale'

Then adding 2 items to the TLayout I.e for my example TPanels - with align options on both set also to 'alscale'. Set the widths of each to the ratio you want.

Form On Creation:

Form On Resize:

Can be achieved with 'no code -'for the images above I just added labels to display panel widths on form resize. Hope this helps Paul

这篇关于Firemonkey / Delphi中的流体/动态布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆