procedure TAlignStringGrid.DrawCell(ACol, ARow: Integer;
ARect: TRect; AState: TGridDrawState);
const
op: array[TAlignment] of DWORD=(DT_LEFT, DT_RIGHT,
DT_CENTER);
var
s: string;
begin
with Canvas do begin
if gdFixed in AState then begin
inherited;
end else begin
s:=Cells[ACol, ARow];
InflateRect(ARect, -2, -2);
DrawText(Handle, PChar(s), Length(s), ARect,
op[FAlignment]+DT_SINGLELINE+DT_VCENTER);
end;
end;
end;