Recent

Author Topic: [SOLVED] TLabel OptimalFill with margins  (Read 507 times)

artem101

  • Jr. Member
  • **
  • Posts: 84
[SOLVED] TLabel OptimalFill with margins
« on: November 30, 2023, 09:03:34 pm »
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)?
« Last Edit: November 30, 2023, 09:41:11 pm by artem101 »

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: TLabel OptimalFill with paddings
« Reply #1 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.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

artem101

  • Jr. Member
  • **
  • Posts: 84
Re: TLabel OptimalFill with paddings
« Reply #2 on: November 30, 2023, 09:18:46 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.
It works. Thanks!

artem101

  • Jr. Member
  • **
  • Posts: 84
Re: TLabel OptimalFill with margins
« Reply #3 on: November 30, 2023, 09:40:40 pm »
Also added Label1.AdjustFontForOptimalFill() to form show and resize events.

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: [SOLVED] TLabel OptimalFill with margins
« Reply #4 on: November 30, 2023, 11:43:45 pm »
just for fun.

 tlabel,tbutton,tpanel with same fitted fonts

« Last Edit: November 30, 2023, 11:45:37 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018