实际使用,这个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
'
'