未完成--- form里各种延时写法的效果比较

实际使用,这个Function delay1(t As Single) 最好用

Private Declare PtrSafe Function MessageBoxTimeout Lib "user32" Alias "MessageBoxTimeoutA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long, ByVal wlange As Long, ByVal dwTimeout As Long) As Long


Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 

Function gcount_full()

         Debug.Print "本轮次数达到20次上限"
         Label22.Visible = True
         Label22.Caption = "本轮次数达到20次上限"
         Label22.BackColor = RGB(255, 255, 0)
              Call delay1(1)
         Label22.Visible = False

End Function

Function delay1(t As Single)
    Dim time1 As Single
    time1 = Timer
    Do
        DoEvents
        time2 = Timer - time1
        If time2 < 0 Then time2 = time2 + 86400
    Loop While time2 < t
    
End Function

下面这些都不太好用

'Function close1(a)
'
'     Sleep (1000)  '居然会先执行sleep 执行完成后再执行之前的 Label22.Visible = True 语句,需要doevents 配合
'     DoEvents
'     Controls("Label" & a).Visible = False
'
'End Function


'Private Sub CommandButton8_Click()
''    Call get_levelup(exp1)
''    Call show_pro1
'
'     Label22.Visible = True
''     Call close1(22)
'
'     Sleep (2000)
'     DoEvents
'     Label22.Visible = False
'
'End Sub

'Private Sub CommandButton8_Click()
''    Call get_levelup(exp1)
''    Call show_pro1
'
'     Label22.Visible = True
'
''     Label22.Refresh
'
'
'     Sleep (1000)  '居然会先执行sleep 执行完成后再执行之前的 Label22.Visible = True 语句
'
'
''     Call timer01(22)
''     Label22.Visible = False
''     Label22.Refresh
'
'
'End Sub


'''Private Sub UserForm_Activate()
'''
'''End Sub
'''
'''Function timer01(a) '得是个常驻得进程才行。。。
'''
'''
'''    t1 = Timer
'''    t2 = Timer - t1
'''    If t2 > 2 Then
'''        Controls("Label" & a).Visible = False
'''    End If
'''
'''
'''End Function


 
' Sub test1a()
'    MessageBoxTimeout 0, "success", "培养成长率", 0, 0, 2000
' End Sub
'
'
' Sub test1b()
'    MessageBoxTimeout 0, "failure", "培养成长率", 0, 0, 2000
' End Sub
'
'
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值