How can I change font size in StringGrid in rad studio XE3 - FM2 Firemonkey 2 not firemonkey 1
3 Answers
I searched internet and it seems that there is no way to resize text into StringGrid.
You can resize header using FindStyleResource('header'):
Change text size in Firemonkey StringGrid
but it is not clear what to use (if any) instead of 'header' so you can change text in the rows. Delphi help files are not useful at all as I cannot find all available parameters that I can use in FindStyleResource function.
As for the answer below:
StringGrid1.Cells[X,Y] do not have a StyleLookup property.
Also, a some people suggested to use OnDrawCell procedure but again it looks like StringGrid is missing this (at least in Delphi XE3 Firemonkey).

- 1
- 1

- 35
- 7
They still don't appear to have made this easy .
The cells are basically TEdits, hence they use the EditStyle for styling. But if you change that you'll change all TEdits. Not what you want.
Ideally there would be a 'CellStyleLookup' property. Set that, modify the style and off you go. But there isn't.

- 4,191
- 4
- 29
- 42
-
What problems are you having with it? (I've added an override directive which should have been there and may have caused your problem). – Mike Sutton Sep 23 '12 at 16:35
-
procedure TFontStringGrid.CreateCellControl: TStyledControl;(it must be function not procudere) - result not defined - where should i write this code – user1581036 Sep 24 '12 at 10:37
-
Yes, sorry, it needs to be a function. You need to create a child component of TStringGrid, as shown in the answer. You can register it on the component palette in the standard way if you want to use it in the designer. – Mike Sutton Sep 24 '12 at 20:13
-
have you ever check your code in xe 3? could you send write here your code – user1581036 Sep 26 '12 at 06:13
-
please someone send an example file to change stringgrid font size in radstudio xe 3- FM2 – user1581036 Oct 03 '12 at 11:22
-
Have you tried the code I gave above? What results did you get? – Mike Sutton Oct 03 '12 at 22:36
-
On another look, I've removed the CreateCellControl stuff and shown code for iterating the columns and rows. – Mike Sutton Oct 03 '12 at 22:48
StringGrid1.StyledSettings.Size := False;
StringGrid1.TextSettings.Font.Size := 18;
This works fine on FireMonkey XE6, But the script that you've reported, regarding the theader, does not work on XE6

- 1,908
- 5
- 20
- 41