XP和Win7的日期格式在系统默认中并不一致,也许会对编程造成困扰,不是吗? 设定系统日期的默认格式可以改变这一问题,可是这听起来并不完美。
通过Forms.TApplication.UpdateFormatSettings设定可以很好的解决问题。这是Help里的描述: Specifies whether format settings are updated automatically when the user alters the system configuration. Use UpdateFormatSettings to control automatic updating of format settings. The default of true is set in the constructor. UpdateFormatSettings is checked when the application receives a WM_WININICHANGE message. Using the default format settings is recommended. These settings are initialized to the Windows local settings. 通过UpdateFormatSettings我们可以手动设定程序所要使用的日期时间格式,代码如下:
这样程序中使用的时间格式就不会再受时间变化影响。 以下的代码或许更全面: procedure Tposmain.sys_format; begin // // end; 本文摘编自网络 |
|