delphi弹出信息框大全

ershen290 贡献于2013-01-20

作者 雨林木风  创建于2010-12-06 03:09:00   修改者雨林木风  修改于2010-12-06 03:13:00字数3903

文档摘要:delphi弹出信息框大全1.警告信息框MessageBox(Handle,'警告信息框','警告信息框',MB_ICONWARNING);2.疑问信息框MessageBox(Handle,'疑问信息框','疑问信息框',MB_ICONQUESTION);3.错误提示框MessageBox(Handle,'错误信息框','错误信息框',MB_ICONERROR);4.提示信息框MessageBox(Handle,'提示信息框','提示信息框',MB_ICONASTERISK);
关键词:

delphi弹出信息框大全 1. 警告信息框 MessageBox(Handle,'警告信息框','警告信息框',MB_ICONWARNING); 2.疑问信息框 MessageBox(Handle,'疑问信息框','疑问信息框',MB_ICONQUESTION); 3.错误提示框 MessageBox(Handle,'错误信息框','错误信息框',MB_ICONERROR); 4.提示信息框 MessageBox(Handle,'提示信息框','提示信息框',MB_ICONASTERISK); 5.说明信息框 MessageBox(Handle,'说明信息框','说明信息框',MB_HELP); 6.提示信息框 MessageBox(Handle,'提示信息框','提示信息框',MB_OK); 7.确认信息框 MessageBox(Handle,'确认信息框','确认信息框',MB_OKCANCEL); 8.重试信息框 MessageBox(Handle,'重试信息框','重试信息框',MB_RETRYCANCEL); 9.是否信息框 Application.MessageBox(Handle,'是否信息框','是否信息框',MB_YESNO); 10.是否取消信息框 Application.MessageBox(Handle,'是否取消信息框','是否取消信息框',MB_YESNOCANCEL); 11 简单提示信息框 ShowMessage('这个就是ShowMessage函数生成的信息提示框!'); _____________________________________________________________________________ 1. 警告信息框 MessageBox(Handle,'程序超出内存。','错误',MB_OK+MB_ICONERROR) MessageBox(0, '配置文件成功', '提示', mb_iconinformation ----------------------------------- 以下是详细说明 //ShowMessage: begin ShowMessage('提示内容'); {标题默认工程名, 如: Proect1} Application.Title := '警告'; {如果修改工程标题...} ShowMessage('提示内容'); {标题是'警告'} ShowMessage('第一行' + #13#10 + '第二行'); {提示信息换行} ShowMessage('第一行'#13'第二行'); {也可以} end; -------------------------------------------------------------------------------- //InputBox: var s: string; begin s := InputBox('标题','提示信息','默认输入'); ShowMessage(s); //显示输入的内容 end; -------------------------------------------------------------------------------- //InputQuery: var s: string; begin InputQuery('标题','提示信息',s); //为字符串变量 S 输入值, 返回布尔型 ShowMessage(s); //显示输入的内容 end; ------- ------------------------------------------------------------------------- //MessageBox: var i: Integer; begin i := MessageBox(0,'提示内容','标题',mrOk); //第一个参数一般用 Self.Handle, 0代表桌面 //可选参数 //mrNone //mrOk //mrCancel //mrAbort //mrRetry //mrIgnore //mrYes / /mrNo //mrAll //mrNoToAll //mrYesToAll ShowMessage(IntToStr(i)); //还可以组合第四个参数以调用不同的图标: MessageBox(0,'提示内容','标题',mrOk + MB_ICONHAND); //MB_ICONHAND //MB_ICONQUESTION //MB_ICONEXCLAMATION //MB_ICONASTERISK //MB_USERICON //MB_ICONWARNING //MB_ICONERROR //MB_ICONINFORMATION //MB_ICONSTOP end; //后来补充, 还是应该使用 API 的原有参数更好些: {可选参数或它们的组合} MB_OK = $00000000; MB_OKCANCEL = $00000001; MB_ABORTRETRYIGNORE = $00000002; MB_YESNOCANCEL = $00000003; MB_YESNO = $00000004; MB_RETRYCANCEL = $00000005; MB_ICONHAND = $00000010; MB_ICONQUESTION = $00000020; MB_ICONEXCLAMATION = $00000030; MB_ICONASTERISK = $00000040; MB_USERICON = $00000080; MB_ICONWARNING = MB_ICONEXCLAMATION; MB_ICONERROR = MB_ICONHAND; MB_ICONINFORMATION = MB_ICONASTERISK; MB_ICONSTOP = MB_ICONHAND; MB_DEFBUTTON1 = $00000000; MB_DEFBUTTON2 = $00000100; MB_DEFBUTTON3 = $00000200; MB_DEFBUTTON4 = $00000300; MB_APPLMODAL = $00000000; MB_SYSTEMMODAL = $00001000; MB_TASKMODAL = $00002000; MB_HELP = $00004000; MB_NOFOCUS = $00008000; MB_SETFOREGROUND = $00010000; MB_DEFAULT_DESKTOP_ONLY = $00020000; MB_TOPMOST = $00040000; MB_RIGHT = $00080000; MB_RTLREADING = $00100000; MB_SERVICE_NOTIFICATION = $00200000; MB_SERVICE_NOTIFICATION_NT3X = $00040000; MB_TYPEMASK = $ 0000000F; MB_ICONMASK = $000000F0; MB_DEFMASK = $00000F00; MB_MODEMASK = $00003000; MB_MISCMASK = $0000C000; {可能的返回值} IDOK = 1; ID_OK = IDOK; IDCANCEL = 2; ID_CANCEL = IDCANCEL; IDABORT = 3; ID_ABORT = IDABORT; IDRETRY = 4; ID_RETRY = IDRETRY; IDIGNORE = 5; ID_IGNORE = IDIGNORE; IDYES = 6; ID_YES = IDYES; IDNO = 7; ID_NO = IDNO; IDCLOSE = 8; ID_CLOSE = IDCLOSE; IDHELP = 9; ID_HELP = IDHELP; IDTRYAGAIN = 10; IDCONTINUE = 11; -------------------------------------------------------------------------------- //MessageDlg: var i: Integer; begin MessageDlg('提示信息',mtWarning,mbYesNo,0); //第二个参数调用不同的图标: //mtWarning //mtError //mtInformation //mtConfirmation //mtCustom //第三个参数调用不同的按钮: //mbYesNo = [mbYes, mbNo]; //mbYesNoCancel = [mbYes, mbNo, mbCancel]; //mbYesAllNoAllCancel = [mbYes, mbYesToAll, mbNo, mbNoToAll, mbCancel]; //mbOKCancel = [mbOK, mbCancel]; //mbAbortRetryIgnore = [mbAbort, mbRetry, mbIgnore]; //mbAbortIgnore = [mbAbort, mbIgnore]; //可以直接输入集合元素,譬如: MessageDlg('aaa',mtWarning,[mbYes],1); //第四个参数帮助ID, 没有添0 //还有重载的第5个参数是设定默认按钮 //如果要本地话显示需要修改源文件, 一般可以用 MessageBox 代替 end; -------------------------------------------------------------------------------- //MessageDlgPos: begin MessageDlgPos('提示信息',mtCustom,mbYesNoCancel,0,400,100); //比 MessageDlg 多出两个参数来控制显示位置 end;

下载文档到电脑,查找使用更方便

文档的实际排版效果,会与网站的显示效果略有不同!!

需要 3 金币 [ 分享文档获得金币 ] 1 人已下载

下载文档