procedure TfrmTest.sgTestDrawCell(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;
var
s :
string;
begin
inherited;
if (ACol
in [1,3..7])
then
Display(sgTest, sgTest.Cells[ACol, ARow])
end;