老板要你做,你符不符合习惯都要做,正所谓,你不吃,你老婆都要吃的,你的子女都要
吃,跟老板对着干没问题,跟老板给你的钱对着干就万万不可。
我研究的初步结果:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids;
type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOTable1: TADOTable;
ADOConnection1: TADOConnection;
procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ADOTable1BeforeScroll(DataSet: TDataSet);
procedure DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
private
{ Private declarations }
F:Boolean;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
with dbgrid1, dbgrid1.SelectedRows do
begin
if (CurrentRowSelected = true)
and (DataSource.Dataset.FieldValues['name'] = '烙铁') //询问条件
and (MessageDlg('你是否选择“烙铁”?', mtConfirmation, [mbYes, mbNo], 0) = mrNo) //询问过程
then
CurrentRowSelected := False;
end;
end;
procedure TForm1.DBGrid1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
with dbgrid1, dbgrid1.SelectedRows do
begin
if (F = true)
and (DataSource.Dataset.FieldValues['name'] = '烙铁') //询问条件
and (MessageDlg('你是否选择“烙铁”?', mtConfirmation, [mbYes, mbNo], 0) = mrNo) //询问过程
then
CurrentRowSelected :=false;
end;
end;
procedure TForm1.ADOTable1BeforeScroll(DataSet: TDataSet);
begin
F:=dbgrid1.SelectedRows.CurrentRowSelected;
end;
end.