//from delphi vcl source
if FRows <> nil then
begin
TSparseList(FRows).ForAll(@FreeItem);
TSparseList(FRows).Free;
end;
if FCols <> nil then
begin
TSparseList(FCols).ForAll(@FreeItem);
TSparseList(FCols).Free;
end;
if FData <> nil then
begin
TSparseList(FData).ForAll(@FreeItem);
TSparseList(FData).Free;
end;先释放自己上面的TSparseListprocedure TCustomGrid.Paint;
DrawCells(LeftCol, TopRow, Horz.FixedBoundary - FColOffset, //!! clip
Vert.FixedBoundary, Horz.GridBoundary, Vert.GridBoundary, Color, []);自己的颜色没有改变所以你看到了//但执行这么快,我就没有看到
if FRows <> nil then
begin
TSparseList(FRows).ForAll(@FreeItem);
TSparseList(FRows).Free;
end;
if FCols <> nil then
begin
TSparseList(FCols).ForAll(@FreeItem);
TSparseList(FCols).Free;
end;
if FData <> nil then
begin
TSparseList(FData).ForAll(@FreeItem);
TSparseList(FData).Free;
end;先释放自己上面的TSparseListprocedure TCustomGrid.Paint;
DrawCells(LeftCol, TopRow, Horz.FixedBoundary - FColOffset, //!! clip
Vert.FixedBoundary, Horz.GridBoundary, Vert.GridBoundary, Color, []);自己的颜色没有改变所以你看到了//但执行这么快,我就没有看到
canvas:= StringGrid1.Canvas;
rec:=StringGrid1.CellRect(j+1,i+1);
canvas.Brush.Color := RGB(10,150,120);
canvas.FillRect(rec);