Delphi 的資訊框相關函式

2021-09-05 18:14:36 字數 4280 閱讀 7219

//showmessage:

begin

showmessage('提示內容');

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_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;

delphi資訊框提示

1 警告資訊框 messagebox handle,警告資訊框 警告資訊框 mb iconwarning 2 疑問資訊框 messagebox handle,疑問資訊框 疑問資訊框 mb iconquestion 3 錯誤提示框 messagebox handle,錯誤資訊框 錯誤資訊框 mb ic...

Delphi指標相關函式

1.addr var i integer nodenumbers array 0 100 of integer begin with treeview1 do begin for i 0 to items.count 1 do begin nodenumbers i calculatevalue i...

Delphi 路徑相關函式

includetrailingpathdelimiter const s string string 功能 返回包括最後路徑分隔符 說明 最後乙個字元是路徑分隔符則不變 否則加上乙個路徑分隔符返回 參考 function sysutils.ispathdelimiter function syste...