分类: 数据库开发技术
2012-05-17 14:39:07
自己动手丰衣足食,顺便给大家当例子了 !!!
1.在窗口的open事件中写如下代码:
Timer(1)
this.triggerevent(timer!)
2.在窗口上添加一个singlelineedit控件用来显示结果
3.在窗口的timer事件中编程:
datetime ldt_now, ldt_future
date ld_now, ld_future
time lt_now, lt_future
long ll_day, ll_second, ll_hour, ll_minute
string ls_result
ld_now = today()
ld_future = date("2004-4-19")
lt_now = now()
lt_future = time("13:05:00")
ll_day = DaysAfter(ld_now, ld_future)
ll_second = SecondsAfter(lt_now, lt_future)
if ll_day > 0 then
ll_hour = ll_day * 24
end if
if ll_second > 0 then
if ll_second - 3600 > 0 then
ll_hour = ll_hour + int(ll_second/3600)
ll_second = mod(ll_second, 3600)
end if
ll_minute = int(ll_second/60)
ll_second = mod(ll_second, 60)
if ll_second = 0 then
ll_minute = ll_minute - 1
ll_second = 60
end if
else
ll_hour = ll_hour - int(abs(ll_second)/3600) - 1
ll_second = mod(ll_second,3600)
ll_minute = 59 - int(abs(ll_second)/60)
ll_second = 60 - mod(abs(ll_second), 60)
end if
ls_result = string(ll_hour) + '小时' + string(ll_minute) + '分' + string(ll_second) + '秒'
sle_1.text = ls_result