VB窗体含有计时器 TIMER时间 但是当弹出MSGBOX时 计时停止了 如何解决 计时可以依然计时
3个回答
展开全部
可以考虑弹出一个设计成msgbox样式的窗体,比如我下面的代码
form1中代码
Dim i%
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
i = i + 1
Me.Caption = i
End Sub
form2中代码,把form2做的小点,想msgbox那样子,这样程序不会挂起
Private Sub Form_Load()
Form2.Command1.Caption = "确定"
Form2.Caption = "警告"
End Sub
form1中代码
Dim i%
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
i = i + 1
Me.Caption = i
End Sub
form2中代码,把form2做的小点,想msgbox那样子,这样程序不会挂起
Private Sub Form_Load()
Form2.Command1.Caption = "确定"
Form2.Caption = "警告"
End Sub
展开全部
Private Sub Timer1_Timer()
Text2.Text = Time
Label3.Caption = Time
End Sub
Private Sub Timer2_Timer()
If i_time = 0 Then
Beep
Else
i_time = i_time - 1
hour = i_time \ 3600
minute = (i_time Mod 3600) \ 60
second = i_time Mod 60
Text2.Text = Str(hour) + ":" + Str(minute) + ":" + Str(second)
End If
End Sub
Private Sub Timer3_Timer()
Label3.Caption = Time
End Sub
Text2.Text = Time
Label3.Caption = Time
End Sub
Private Sub Timer2_Timer()
If i_time = 0 Then
Beep
Else
i_time = i_time - 1
hour = i_time \ 3600
minute = (i_time Mod 3600) \ 60
second = i_time Mod 60
Text2.Text = Str(hour) + ":" + Str(minute) + ":" + Str(second)
End If
End Sub
Private Sub Timer3_Timer()
Label3.Caption = Time
End Sub
参考资料: 时间
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
弹出那个就中断程序了 最好别两个同时用
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询