Changing the Default Grid Font - FireMonkey Guide

You can change the default font for a grid by changing the default font for a TTextCell, which is the class for a cell containing text and is basically the same as a TEdit. However, loading the style into the style editor requires taking something of a roundabout route.

  • Add a TEdit to your form.
  • Set the StyleLookup property to ‘TextCellStyle’.
  • Right click and select edit custom style.
  • The editor will now have loaded the default TextCellStyle into the style editor but it will, for some unknown reason, have renamed it as ‘edit1style1’ (even if you already have a style by that name) so,
  • Find the (correct) edit1style1 in the structure pane and select it.
  • In the property editor change the StyleName (NOT Name) property to TextCellStyle. This change will not be reflected in the structure pane, but will have taken effect.
  • Click Apply and Close to save this change.
  • Go back to your TEdit and change the StyleName (again) to TextCellStyle.
  • Since the default style for a text cell has no background your TEdit will now be invisible, so I recommend adding some Text!
  • Again, right click and select Edit Custom Style. You are now ready to edit your default text cell style.
  • Navigate again to TextCellStyle, expand it and edit away. The Font object, rather obviously, specifies the font and the ForeGround property the font colour.
  • Click Apply and Close to save your changes and, if all has gone well, your grid will now be using your new font.

Categories:

div title=