procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
procedure WriteText(StringGrid: TStringGrid; ACanvas: TCanvas;
const ARect: TRect;
const Text:
string);
const
DY = 2;
var
S:
array[0..255]
of Char;
begin
with Stringgrid, ACanvas, ARect
do begin
ExtTextOut(
Handle, Right - TextWidth(Text) - 3, Top + DY,
ETO_OPAQUE
or ETO_CLIPPED, @ARect, StrPCopy(S, Text),
Length( Text),
nil);
end;
end;
procedure Display(StringGrid: TStringGrid;
const S:
string);
begin
WriteText(StringGrid, StringGrid.Canvas, Rect, S);
end;
begin
inherited;
if (ACol = 1)
or (ACol >=4)
then
Display(StringGrid1, StringGrid1.Cells[ACol, ARow]);
end;