Author: Tomas Rutkauskas
How to change the font properties of a certain row or column in a TStringGrid
Answer:
You can do it by handling the OnDrawCell event.
1 2 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
3 Rect: TRect; State: TGridDrawState);
4 begin5 StringGrid1.Canvas.FillRect(Rect);
6 if ARow = 1 then{Use ACol for column or use both for a cell}7 begin8 StringGrid1.Canvas.Font.Color := clBlue;
9 StringGrid1.Canvas.Font.Name := 'Tahoma';
10 StringGrid1.Canvas.Font.Style := StringGrid1.Canvas.Font.Style + [fsBold];
11 end;
12 DrawText(StringGrid1.Canvas.Handle, PChar(StringGrid1.Cells[ACol, ARow]), -1,
13 Rect, DT_SINGLELINE or DT_VCENTER or DT_LEFT);
14 end;