Using the TAdvStringGrid and a TAdvFontSelector, how do you change a font for a selected cell?
I have tried:
grid.Fonts[grid.Col,grid.Row] := fontselector1.Font;
Nothing changes except the alignment of the text.
I use code similar to the above to change the cell's text colour and background colours ok.
Thanks
I do not know what the value of FontSelector.Font is but here with setting this via:
var
fnt: tfont;
begin
fnt := TFont.Create;
fnt.Name := 'COURIER';
advstringgrid1.Fonts[advstringgrid1.Col,advstringgrid1.Row] := fnt;
fnt.Free;
end;
this works fine and it is clearly visible that the font becomes a COURIER font in the selected cell.
Thanks Bruno
The issue was in both the grid and the officefontselector code I was using.
I changed my code to:
grid.FontNames[grid.Col,grid.Row] := fontselector1.text; and now the chosen font updates the cell just fine.
The fontselector needed a reference to the text string and not 'font'.
Cheers