|
我使用addmenu宏命令制作了一个菜单,作为主窗体使用,并加入了如下代码,希望在他不使用时达到一定时限就提示推出,可在使用addmenu生成的菜单时,计时器应在计时,无法达到打开其他窗体时停止计时的预期效果,请高手指教!
Private Sub Form_Activate()
Me.提示.Visible = False
Me.TimerInterval = 0
Me.TimerInterval = 3000
End Sub
Private Sub Form_Deactivate()
Me.提示.Visible = False
Me.TimerInterval = 0
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Form_Activate
End Sub
Private Sub Form_LostFocus()
Me.提示.Visible = False
Me.TimerInterval = 0
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form_Activate
End Sub
Private Sub Form_Timer()
If Me.TimerInterval = 5000 Then Quit '提示后仍无操作,退出。
Me.提示.Visible = True
Me.提示.Caption = "您已有" & Format(3000 / 60000, "0.0") & "分钟没操作了!请点击鼠标!否则系统将在5秒钟内退出! "
Me.提示.ForeColor = 255
Me.TimerInterval = 5000
End Sub
Private Sub 提示_Click()
Form_Activate
End Sub
Private Sub 主体_Click()
Form_Activate
End Sub |
|