例子 procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);begin if MessageDlg('Close the form?', mtConfirmation, [mbOk, mbCancel], 0) = mrCancel then CanClose := False; end;
procedure Tfrmmain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin if Application.MessageBox('您确定要退出吗?','提示',MB_OKCANCEL+MB_DEFBUTTON2+MB_ICONWARNING)=IDOK then CanClose := True else CanClose := False; end;
if MessageBox(0,'是否关闭','显示',MB_OKCANCEL)=1 then CanClose:=true else CanClose:=false; inherited;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);begin
if MessageDlg('Close the form?', mtConfirmation,
[mbOk, mbCancel], 0) = mrCancel then
CanClose := False;
end;
begin
if Application.MessageBox('您确定要退出吗?','提示',MB_OKCANCEL+MB_DEFBUTTON2+MB_ICONWARNING)=IDOK then
CanClose := True
else
CanClose := False;
end;
CanClose:=true
else
CanClose:=false;
inherited;