Forum > LCL

[SOLVED] TLabel OptimalFill with margins

(1/1)

artem101:
I have TLabel which should occupy maximum available space of parent component TForm. Setting property OptimalFill=True makes what I need, but is it possible to add some margins around label text (for example: 25px)?

Josh:
have you tried settings the anchors so that it is alligned to left and right of form, with a padding of 25 either side.

artem101:

--- Quote from: Josh on November 30, 2023, 09:06:48 pm ---have you tried settings the anchors so that it is alligned to left and right of form, with a padding of 25 either side.

--- End quote ---
It works. Thanks!

artem101:
Also added Label1.AdjustFontForOptimalFill() to form show and resize events.

Josh:
just for fun.

 tlabel,tbutton,tpanel with same fitted fonts

Navigation

[0] Message Index

Go to full version