procedure Tfrmcgdd.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin if QDetail.State in dsEditModes then begin if MessageBox(Handle, ‘确认是否保存单据资料?‘,‘信息提示‘, MB_OKCANCEL + MB_ICONQUESTION) = IDOK then begin SpeedButton1.Click; CanClose := True; end end; end;