Format和MessageBox函数使用说明

字体大小: 中小 标准 ->行高大小: 标准
Format函式使用解说


 
1. function Format(const Format: string; const Args: array of const): string;
   Format : 想要传回的字符串格式。
   Args : 格式字符串内所需的参数,array of const 是一个 Variant 的动态数组。
   result : 传回转换后的字符串。
   
   置换符号有很多,我列几个常用的你参考看看。
   %d 整数。
   %f 浮点数。
   %s 字符串。
   5x 整数转为 16 进位输出。
   
Ex:
   format ('%s 你好,您是第 %d 个光临的客人。', ['沉默羔羊', 5]);
  上面的函式会传回 沉默羔羊 你好,您是第 5 个光临的客人。
 
2. function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;
   Text : 对话窗口中的文字。
   Caption : 对话窗口左上角的文字。
   Flags : 对话框可使用按钮种类
      MB_ABORTRETRYIGNORE 放弃 重试 忽略
      MB_OK      The 确定
      MB_OKCANCEL       : 确定 放弃
      MB_RETRYCANCEL    : 重试 放弃
      MB_YESNO   : 是 否
      MB_YESNOCANCEL    : 是 否 放弃
 
   result : 传回使用者的案件选择
      IDOK
      IDCANCEL
      IDABORT
      IDRETRY
      IDIGNORE
      IDYES
      IDNO

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/67865.html