2010. december 9., csütörtök

Clear a TStringGrid


I have a form with a stringgrid on it. I use the grid to display some data regarding a certain part. How do I clear the grid, that still holds data from the first display, before I display data of a different part?


You have to loop over the rows or cols or even cells (depends on how the grid is layed out):

with StringGrid1 do
  perform(WM_SETREDRAW, 0, 0); {block visual updates}
    for i := fixedRows to Rowcount - 1 do
    perform(WM_SETREDRAW, 1, 0);

Since this wipes complete rows it would not be suitable if you have a fixed column on the left that should be preserved, for example.

Nincsenek megjegyzések:

Megjegyzés küldése