简体   繁体   English

我可以在Delphi中组合对齐布局吗?

[英]Can I combine align layouts in Delphi?

I want to make a label, that occupies all empty space, and at the same time has centered text. 我想制作一个标签,该标签将占据所有空白区域,同时将文本居中。

// firemonkey code, 
// causes compile-time error "E2010 Incompatible types: 'TAlignLayout' and 'Set'"
GreedyLbl.Align := [TAlignLayout.alClient, TAlignLayout.alCenter];  

I've also looked for a suitable constant on embarcadero wiki , but with no result. 我还在embarcadero wiki寻找了合适的常量,但没有结果。 Maybe someone knows how can I make a described label? 也许有人知道如何制作描述标签?

It looks like you're pretty close. 看来您已经很接近了。 Try setting the Align to just TAlignLayout.alClient . 尝试将Align设置为TAlignLayout.alClient Then set the TextAlign to TTextAlign.taCenter . 然后将TextAlign设置为TTextAlign.taCenter

The Align property is part of TControl and comes into play anytime there is a control with a visual aspect to it. Align属性是TControl一部分,只要存在带有视觉外观的控件,它就会起作用。

The TextAlign property only involves controls descended from TTextControl , like a TLabel . TextAlign属性仅包含从TTextControl继承的TTextControl ,例如TLabel (Also: TTextControl descends from TControl ). (另外: TTextControl从下降TControl )。

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

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