//==============================================================================
//全选DBGrid中所有数据**********************************************************
//==============================================================================
procedure DBGridSelectAll(DBGrid: TDBGrid);
var SavePlace: TBook;
begin
with DBGrid do
begin//01
if (dgMultiSelect in Options) and DataSource.DataSet.Active
then with DataSource.Dataset do
begin//02
if (BOF and EOF) then Exit;
DisableControls;
try
SavePlace := GetBook;//保存
try
First;
while not EOF do
begin//03
SelectedRows.CurrentRowSelected := True;
Next;
end;//03
finally
try
GotoBook(SavePlace);//回到书签
except
end;
FreeBook(SavePlace);//释放
end;
finally
EnableControls;
end;
end;//02
end;//01
end;
//全选DBGrid中所有数据**********************************************************
//==============================================================================
procedure DBGridSelectAll(DBGrid: TDBGrid);
var SavePlace: TBook;
begin
with DBGrid do
begin//01
if (dgMultiSelect in Options) and DataSource.DataSet.Active
then with DataSource.Dataset do
begin//02
if (BOF and EOF) then Exit;
DisableControls;
try
SavePlace := GetBook;//保存
try
First;
while not EOF do
begin//03
SelectedRows.CurrentRowSelected := True;
Next;
end;//03
finally
try
GotoBook(SavePlace);//回到书签
except
end;
FreeBook(SavePlace);//释放
end;
finally
EnableControls;
end;
end;//02
end;//01
end;
书签(Ctrl+Shift+Number)好像不会保存。