2007. december 10., hétfő
Change the font properties of a certain row or column in a TStringGrid
Problem/Question/Abstract:
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.
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
if ARow = 1 then {Use ACol for column or use both for a cell}
begin
StringGrid1.Canvas.Font.Color := clBlue;
StringGrid1.Canvas.Font.Name := 'Tahoma';
StringGrid1.Canvas.Font.Style := StringGrid1.Canvas.Font.Style + [fsBold];
end;
DrawText(StringGrid1.Canvas.Handle, PChar(StringGrid1.Cells[ACol, ARow]), -1,
Rect, DT_SINGLELINE or DT_VCENTER or DT_LEFT);
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése