我今天用TStringGrid还碰到了一个奇怪的问题。
不知道是不是我倒霉。
我给TStringGrid.Cells[i,j]赋值。然后ShowMessage这个Cell,发现,Show出来的值和Cell显示的值竟然不一样????
又是怎么回事??
代码如下:
    with StrGrd do
    begin
        Cells[0,RowCount] := Format('%0.2d',[RowCount]);        RowCount := RowCount+1;        Cells[0,RowCount] := Format('%0.2d',[RowCount]);
    end;

解决方案 »

  1.   

    是不是数值精度的问题?四舍五入一下或者currncy类型?
      

  2.   

    你是通过ShowMessage(StrGrd.Cells[1,2]);等显示数据吗?
    否则就是你错了!
      

  3.   

    stringGrid的cells[列,行]
    你show的时候行列号不对吧?
      

  4.   

    with StrGrd do
        begin
            Cells[0,RowCount] := Format('%0.2d',[RowCount]);        RowCount := RowCount+1;        Cells[0,RowCount] := Format('%0.2d',[RowCount]);
            ShowMessage(Cells[0,RowCount] );
        end;
    就是这么简单。和行、和列有关系么???