MessageDlg( 'string', mtError, mbCancel, 0);[Error] Unit1.pas(250): Incompatible types: 'TMsgDlgButtons' and 'TMsgDlgBtn' [Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit1.pas'
procedure TForm1.Button1Click(Sender: TObject);begin if MessageDlg('Welcome to my Delphi application. Exit now?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then begin MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); Close; end;end;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
MessageDlg( 'string', mtError, [mbCancel], 0);函数原型为:
function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
if MessageDlg('Welcome to my Delphi application. Exit now?',
mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
begin
MessageDlg('Exiting the Delphi application.', mtInformation,
[mbOk], 0, mbOk);
Close;
end;end;
我寫程序常用這個.