怎么让对话框显示中文内容,包括标题、按钮的文字,大家说说~(50分)

  • 主题发起人 主题发起人 tatagee
  • 开始时间 开始时间
T

tatagee

Unregistered / Unconfirmed
GUEST, unregistred user!
Delphi里MessageDlg默认显示的是英文,也可以用中文显示标题和信息,但是怎么样能把按钮的文字也显示成中文呢? 对了,还要能显示叹号、问号的那种小图标,大家给点意见吧。如果想说自己做个窗体的也行,就算帮忙顶一下了~ 哈~[:)]
 

Dialogs

function CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType;
函数
 
application.messagebox()有个函数是全中文的
 
Application.messagebox
//这个函数的语言是由系统语言决定的
 
MessageBox(Handle, '内容', '标题', MB_OK or MB_ICONQUESTION or 以下Flags);

{ MessageBox() Flags }
{$EXTERNALSYM MB_OK}
MB_OK = $00000000;
{$EXTERNALSYM MB_OKCANCEL}
MB_OKCANCEL = $00000001;
{$EXTERNALSYM MB_ABORTRETRYIGNORE}
MB_ABORTRETRYIGNORE = $00000002;
{$EXTERNALSYM MB_YESNOCANCEL}
MB_YESNOCANCEL = $00000003;
{$EXTERNALSYM MB_YESNO}
MB_YESNO = $00000004;
{$EXTERNALSYM MB_RETRYCANCEL}
MB_RETRYCANCEL = $00000005;

{$EXTERNALSYM MB_ICONHAND}
MB_ICONHAND = $00000010;
{$EXTERNALSYM MB_ICONQUESTION}
MB_ICONQUESTION = $00000020;
{$EXTERNALSYM MB_ICONEXCLAMATION}
MB_ICONEXCLAMATION = $00000030;
{$EXTERNALSYM MB_ICONASTERISK}
MB_ICONASTERISK = $00000040;
{$EXTERNALSYM MB_USERICON}
MB_USERICON = $00000080;
{$EXTERNALSYM MB_ICONWARNING}
MB_ICONWARNING = MB_ICONEXCLAMATION;
{$EXTERNALSYM MB_ICONERROR}
MB_ICONERROR = MB_ICONHAND;
{$EXTERNALSYM MB_ICONINFORMATION}
MB_ICONINFORMATION = MB_ICONASTERISK;
{$EXTERNALSYM MB_ICONSTOP}
MB_ICONSTOP = MB_ICONHAND;

{$EXTERNALSYM MB_DEFBUTTON1}
MB_DEFBUTTON1 = $00000000;
{$EXTERNALSYM MB_DEFBUTTON2}
MB_DEFBUTTON2 = $00000100;
{$EXTERNALSYM MB_DEFBUTTON3}
MB_DEFBUTTON3 = $00000200;
{$EXTERNALSYM MB_DEFBUTTON4}
MB_DEFBUTTON4 = $00000300;

{$EXTERNALSYM MB_APPLMODAL}
MB_APPLMODAL = $00000000;
{$EXTERNALSYM MB_SYSTEMMODAL}
MB_SYSTEMMODAL = $00001000;
{$EXTERNALSYM MB_TASKMODAL}
MB_TASKMODAL = $00002000;
{$EXTERNALSYM MB_HELP}
MB_HELP = $00004000; { Help Button }

{$EXTERNALSYM MB_NOFOCUS}
MB_NOFOCUS = $00008000;
{$EXTERNALSYM MB_SETFOREGROUND}
MB_SETFOREGROUND = $00010000;
{$EXTERNALSYM MB_DEFAULT_DESKTOP_ONLY}
MB_DEFAULT_DESKTOP_ONLY = $00020000;

{$EXTERNALSYM MB_TOPMOST}
MB_TOPMOST = $00040000;
{$EXTERNALSYM MB_RIGHT}
MB_RIGHT = $00080000;
{$EXTERNALSYM MB_RTLREADING}
MB_RTLREADING = $00100000;

{$EXTERNALSYM MB_SERVICE_NOTIFICATION}
MB_SERVICE_NOTIFICATION = $00200000;
{$EXTERNALSYM MB_SERVICE_NOTIFICATION_NT3X}
MB_SERVICE_NOTIFICATION_NT3X = $00040000;

{$EXTERNALSYM MB_TYPEMASK}
MB_TYPEMASK = $0000000F;
{$EXTERNALSYM MB_ICONMASK}
MB_ICONMASK = $000000F0;
{$EXTERNALSYM MB_DEFMASK}
MB_DEFMASK = $00000F00;
{$EXTERNALSYM MB_MODEMASK}
MB_MODEMASK = $00003000;
{$EXTERNALSYM MB_MISCMASK}
MB_MISCMASK = $0000C000;
 
查看MessageBoxEx的帮助,它最后一个参数是代表语言的。有中文。

MessageBoxEx(hWnd: HWND; lpText, lpCaption: PChar;
uType: UINT; wLanguageId: Word): Integer;
//LANG_CHINESE 表示中文吧.
 
你可以把delphi的pas汉化了,你编译后就是中文的了。
 
Application.MessageBox('内容','标题',MB_OK+mb_ICError)
 
自己做一個.....
 
如果你使用的中文系统时使用MESSAGEBOX函数它默认显示的是中文,
不过它的扩展函数MessageBoxEx可以指定语言类型,如中文:
MessageBoxEx(Handle,pchar('错误信息'),pchar('警告'),MB_ICONWARNING,LANG_CHINESE) ;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部