我知道MessageBox 可以用MB_DefButton进行预设 MessageDlg 怎样设置一触发 焦点在哪个按妞上呢?

解决方案 »

  1.   

    MessageDlg的按钮参数在Dialogs单元定义,类型是TMsgDlgButtons(注意:不是TMsgDlgButton类型),如下TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp);
    TMsgDlgButtons = set of TMsgDlgBtn;使用的时候,直接用下面的方式MessageDlg('Exiting the Delphi application.', mtInformation,[mbOk], 0, mbOk);
    由于是集合类型的参数,所以必须用方括号进行围注!
      

  2.   

    MessageDlg的按钮参数在Dialogs单元定义,类型是TMsgDlgButtons(注意:不是TMsgDlgButton类型),如下TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp);
    TMsgDlgButtons = set of TMsgDlgBtn;使用的时候,直接用下面的方式MessageDlg('Exiting the Delphi application.', mtInformation,[mbOk], 0, mbOk);
    由于是集合类型的参数,所以必须用方括号进行围注!
      

  3.   

    TMsgDlgBtn Value     Corresponding return valuembOk               mrOk
    mbCancel                mrCancel
    mbYes                mrYes
    mbNo                  mrNo
    mbAbort                 mrAbort
    mbRetry                 mrRetry
    mbIgnore                   mrIgnore具体可以看帮助,有例子
      

  4.   

    function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Word;
    function MessageDlg(const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;
    function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Button1, Button2, Button3: TMsgDlgBtn; HelpCtx: Longint; X, Y: Integer; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;
      

  5.   

    我是想一触发MESSAGEDLG 就让焦点固定在一个按纽上 现在MESSAGEDLG默认在最前面的按纽上
      

  6.   

    MessageDlg('Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0, mbno) = mrYes then close;
      

  7.   

    MessageDlg('WWWW',mtConfirmation, [OK], 0);
      

  8.   

    to tigsin() 
    MessageDlg('Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0, mbno) = mrYes then close;你编译有问题?
      

  9.   

    if MessageDlg('Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0, mbno) = mrYes then close;