function IsNum(str: string): boolean;
var
i: integer;
begin
for i := 1 to length(str) do
if not (str[i] in ['0'..'9', '.', '+', '-']) then
begin
result := false;
exit;
end;
result := true;
end;
begin
strCellText := asg1.Cells[ACol, ARow]; //获得Cell的内容
if strCellText = '' then exit;
if IsNum(strCellText) then //判断是否是数字
begin
dblValue := strtofloat(strCellText);
dblValue := dblValue * 100; //由于是百分率,所以要乘上100
strCellText := format('%.2f', [dblValue]) + '%'; //格式化
asg1.Canvas.FillRect(Rect); //清空原显示
asg1.Canvas.TextOut(Rect.Left, Rect.Top, strCellText); //把文字画出来
end;
end;