var I,J: Integer; begin for I := 0 to StringGrid1.RowCount - 1 do for J := 0 to StringGrid1.ColCount - 1 do begin StringGrid1.Cells[J,I] := ''; end; end;
stringgrid.setfocus := false; for I := 0 to stringgrid.ColCount do for j:= 0 to stringgrid.rowcount do stringgrid.cells[i,j]:= ''
var I,J: Integer; begin for I := 0 to StringGrid1.RowCount - 1 do for J := 0 to StringGrid1.ColCount - 1 do begin StringGrid1.Cells[J,I] := ''; end; end; 看来只能这样做了
如果需要, 再設Rowcount, ColCount 為原來的
I,J: Integer;
begin
for I := 0 to StringGrid1.RowCount - 1 do
for J := 0 to StringGrid1.ColCount - 1 do
begin
StringGrid1.Cells[J,I] := '';
end;
end;
for I := 0 to stringgrid.ColCount do
for j:= 0 to stringgrid.rowcount do
stringgrid.cells[i,j]:= ''
照你的提示我测试了一下,有些问题,当再設Rowcount, ColCount 為原來的时候,内容还是存在的、
I,J: Integer;
begin
for I := 0 to StringGrid1.RowCount - 1 do
for J := 0 to StringGrid1.ColCount - 1 do
begin
StringGrid1.Cells[J,I] := '';
end;
end;
看来只能这样做了
StringGrid1.ColCount :=2