zoukankan      html  css  js  c++  java
  • 在Delphi下,如何使ShowMessage中的按钮中文化

    如果你使用messagedlg(对showmessage也适用)可以汉化定义按钮caption的常量,具体操作步骤如下:

    1.   打开文件consts.pas(在Delphi安装目录的/source/vcl下)    

     
       
     2.   将以下资源字符串常量的值进行改动:    
     
     
          SMsgDlgWarning   =   '警告';  
     
          SMsgDlgError   =   '错误';  
     
          SMsgDlgInformation   =   '信息';  
     
          SMsgDlgConfirm   =   '确认';  
     
          SMsgDlgYes   =   '(&Y)是';  
     
          SMsgDlgNo   =   '(&N)否';  
     
          SMsgDlgOK   =   '确定';  
     
          SMsgDlgCancel   =   '放弃';  
     
          SMsgDlgHelp   =   '(&H)帮助';  
     
          SMsgDlgHelpNone   =   '无效的帮助';  
     
          SMsgDlgHelpHelp   =   '帮助';  
     
          SMsgDlgAbort   =   '(&A)放弃';  
     
          SMsgDlgRetry   =   '(&R)重试';  
     
          SMsgDlgIgnore   =   '(&I)忽略';  
     
          SMsgDlgAll   =   '(&A)全部';  
     
          SMsgDlgNoToAll   =   '(&o)全不';  
     
          SMsgDlgYesToAll   =   '(&A)全是';  
     
     ----   经过这样改动后,对应按钮的热键仍然可以使用。    
     3.打开文件dialogs.pas(在Delphi安装目录的/source/vcl下)  
     
     4.查到ButtonCaptions:  
                 ButtonCaptions:   array[TMsgDlgBtn]   of   Pointer   =   (  
              @SMsgDlgYes,   @SMsgDlgNo,   @SMsgDlgOK,   @SMsgDlgCancel,  
              @SMsgDlgAbort,@SMsgDlgRetry,   @SMsgDlgIgnore,   @SMsgDlgAll,    
              @SMsgDlgNoToAll,   @SMsgDlgYesToAll,     @SMsgDlgHelp);  
          改为  
              ButtonCaptions:   array[TMsgDlgBtn]   of   string   =   (  
              '是',   '否',   '确定',   '取消',   '退出','重试',   '跳过',    
              '所有',   '全不',   'YesToAll',   '帮助');  
             LoadResString(ButtonCaptions[B])   改为ButtonCaptions[B]  
     (注意共有二处,因为上面已经将指针类型改为String,所以这里直接用ButtonCaptions[B]  
        5.   修改后编译生成dialog.dcu、consts.dcu文件。(如何编译请参照本博客delphi技巧13)  
       6.           将dialog.dcu、consts.dcu文件拷贝到../delphi6/lib目录下。
  • 相关阅读:
    南北朝
    霍去病
    晋 司马
    唐代 诗人
    Getting Started with Google Tango(Google Tango开始教程)
    第二届普适计算和信号处理及应用国际会议论文2016年 The 2nd Conference on Pervasive Computing, Signal Processing and Applications(PCSPA, 2016)
    TurtleBot教程
    ROS教程
    《SLAM for Dummies》中文版《SLAM初学者教程》
    Sensor fusion(传感器融合)
  • 原文地址:https://www.cnblogs.com/China3S/p/3538414.html
Copyright © 2011-2022 走看看