procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var sCad:String;
i:integer;
bEsNum:Bool;
begin
if StringGrid1.Cells[Col,Row] <> '' then
begin
bEsNum := True;
sCad := StringGrid1.Cells[Col,Row];
for i:=1 to length(sCad) do
if not (sCad[i] in ['0'..'9','-']) then bEsNum := False;
if bEsNum then
begin
sCad := Format('%15.0n',[StrToFloat(StringGrid1.Cells[Col,Row])]);
with StringGrid1 do
with Canvas,Rect do
begin
i:=Right-TextWidth(sCad+' ');
Canvas.FillRect(Rect);
Canvas.TextOut(i,Top+2,sCad);
end;
end;
end;
end;