-1

I am working with a Listbox and I am trying to change the Font Size of the listbox "Itemdata.detail" proporty in runtime. I was able to change the "ItemData.Text" font size, but I need also to change the font size for the "ItemData.Detail"

{ With ListBoxItem do Begin StyledSettings:=[TStyledSetting.Family,TStyledSetting.Style,TStyledSetting.FontColor,TStyledSetting.Other]; Size.Height:=50; Font.Size:=12;

          Size.PlatformDefault := False;
          Text :=FormPrincipal.UniqueryGeral.Fields[1].AsString;
          ItemData.Detail:= FormPrincipal.UniqueryGeral.Fields[0].AsString+' vezes '+'/'+' ACERTOS = '+FormatFloat('###.##',FormPrincipal.UniqueryGeral.Fields[2].asFloat)+'%'+' - ERROS= '+FormatFloat('###.##',(FormPrincipal.UniqueryGeral.Fields[3].AsFloat))+'%';
          StyleLookup := 'listboxitembottomdetail';
          Visible := True;
          Parent := FormPrincipal.ListBox_EstatisticasPROF_2_Resultado;
          Inc(conta_linha);
        End;

}

aalmeidasp
  • 13
  • 1
  • 5

1 Answers1

0

Style customization for TListBoxItem at design time is very limited. Try this:

ListBoxItem.StylesData['detail.TextSettings.Font.Size']:=20;

It takes advantage of the StylesData property which stores values for the properties of all the objects inside a style at run time. Style listboxitembottomdetail is composed of a few objects including one named detail which is a TText object and is mapped to the ItemData.Detail property of the TListBoxItem. Combining the name of the object and the desired property allows access to it.

If you want to change detail text font color do this instead:

ListBoxItem.StylesData['detail.TextSettings.FontColor']:=TAlphaColors.Blue;
Alex Sawers
  • 636
  • 4
  • 11