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. 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. Then set the TextAlign to TTextAlign.taCenter.

The Align property is part of TControl and comes into play anytime there is a control with a visual aspect to it.

The TextAlign property only involves controls descended from TTextControl, like a TLabel. (Also: TTextControl descends from TControl).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top