在Keypress里写的东西:
if key=#13 then
  begin
              StringGrid1.Cells[StringGrid1.Col,StringGrid1.Row]:='  '+Format('%.2f',[StrToFloat(StringGrid1.Col,StringGrid1.Row)]);
  end;只有键盘响应,如果使鼠标也实现这样的功能!即鼠标点另外一个cell后,也能实现同样的功能!

解决方案 »

  1.   

    在 OnmouseMOve事件写上上面的代码! 看看!
      

  2.   

    procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
      ARow: Integer; var CanSelect: Boolean);
    begin
      StringGrid1.Cells[ACol,ARow]:='  '+Format('%.2f',[StrToFloat(ACol,ARow)]);
    end;
      

  3.   

    if key=vk_lbutton then
      begin
                  StringGrid1.Cells[StringGrid1.Col,StringGrid1.Row]:='  '+Format    ('%.2f',[StrToFloat(StringGrid1.Col,StringGrid1.Row)]);
      end;
    试试呢。