Chinaunix首页 | 论坛 | 博客
  • 博客访问: 400826
  • 博文数量: 152
  • 博客积分: 1885
  • 博客等级: 上尉
  • 技术积分: 1306
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-13 16:51
文章分类

全部博文(152)

文章存档

2013年(1)

2012年(17)

2011年(19)

2010年(109)

2009年(6)

我的朋友

分类: 数据库开发技术

2012-05-17 14:39:07

long   il_time
time   it_start,it_end

open
      il_time   =   200
      it_start   =   Now()
      timer(1)

timer
      it_end   =   Now()
      If   il_time   <=   SecondsAfter(it_start,   it_end)   then
            messagebox( "提示 ", "时间到! ")
            timer(0)
            return
      End   if
////////////////////
//方法二:

自己动手丰衣足食,顺便给大家当例子了 !!!

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


阅读(5168) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~