//全选
procedure TFrameCustSelector.ToolButton1Click(Sender: TObject);
var
OldCurrent: TBookmark;
begin
OldCurrent := DBGrid1.DataSource.DataSet.Bookmark;
DBGrid1.DataSource.DataSet.DisableControls;
DBGrid1.DataSource.DataSet.First ;
while not DBGrid1.DataSource.DataSet.Eof do begin
DBGrid1.SelectedRows.CurrentRowSelected := true;
DBGrid1.DataSource.DataSet.Next;
end;
DBGrid1.DataSource.DataSet.GotoBookmark(OldCurrent);
DBGrid1.DataSource.DataSet.EnableControls;
end;
//全清
procedure TFrameCustSelector.ToolButton2Click(Sender: TObject);
var
OldCurrent: TBookmark;
begin
OldCurrent := DBGrid1.DataSource.DataSet.Bookmark;
DBGrid1.DataSource.DataSet.DisableControls;
DBGrid1.DataSource.DataSet.First ;
while not DBGrid1.DataSource.DataSet.Eof do begin
DBGrid1.SelectedRows.CurrentRowSelected := False;
DBGrid1.DataSource.DataSet.Next;
end;
DBGrid1.DataSource.DataSet.GotoBookmark(OldCurrent);
DBGrid1.DataSource.DataSet.EnableControls;
end;
//反选
procedure TFrameCustSelector.ToolButton3Click(Sender: TObject);
var
OldCurrent: TBookmark;
begin
OldCurrent := DBGrid1.DataSource.DataSet.Bookmark;
DBGrid1.DataSource.DataSet.DisableControls;
DBGrid1.DataSource.DataSet.First ;
while not DBGrid1.DataSource.DataSet.Eof do begin
DBGrid1.SelectedRows.CurrentRowSelected := not DBGrid1.SelectedRows.CurrentRowSelected;
DBGrid1.DataSource.DataSet.Next;
end;
DBGrid1.DataSource.DataSet.GotoBookmark(OldCurrent);
DBGrid1.DataSource.DataSet.EnableControls;
end;