Fluid/Dynamic layout in Firemonkey / Delphi

大城市里の小女人 提交于 2019-12-01 00:58:15

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/11875691/fluid-dynamic-layout-in-firemonkey-delphi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!