我今天用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;
不知道是不是我倒霉。
我给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;
否则就是你错了!
你show的时候行列号不对吧?
begin
Cells[0,RowCount] := Format('%0.2d',[RowCount]); RowCount := RowCount+1; Cells[0,RowCount] := Format('%0.2d',[RowCount]);
ShowMessage(Cells[0,RowCount] );
end;
就是这么简单。和行、和列有关系么???