我做的一个系统中这么做的,有几百条记录的情况下,没有明显的延迟:
procedure TfrmCTI.BitBtn3Click(Sender: TObject);
var
tempPos: integer;
begin
With dbgDW do begin
tempPos := DataSource.DataSet.RecNo - 1;
DataSource.DataSet.DisableControls;
DataSource.DataSet.First;
while not DataSource.DataSet.Eof do begin
SelectedRows.CurrentRowSelected := not SelectedRows.CurrentRowSelected;
DataSource.DataSet.Next;
end;
DataSource.DataSet.First;
DataSource.DataSet.MoveBy(tempPos);
DataSource.DataSet.EnableControls;
LabelCount.Caption := '共选中:'+inttostr(SelectedRows.Count)+'户';
end;
end;