加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

vb6.0 倒计时

发布时间:2020-12-17 08:08:19 所属栏目:百科 来源:网络整理
导读:Dim tDim start As BooleanPrivate Sub Command1_Click() If start = False Then t = Val(Text1) * 3600 + Val(Text2) * 60 + Val(Text3) start = True End If Timer1.Enabled = True Command3.Enabled = TrueEnd SubPrivate Sub Command2_Click() Timer1.En
Dim t
Dim start As Boolean
Private Sub Command1_Click()
   If start = False Then
      t = Val(Text1) * 3600 + Val(Text2) * 60 + Val(Text3)
      start = True
   End If
   Timer1.Enabled = True
   Command3.Enabled = True
End Sub
Private Sub Command2_Click()
   Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
   t = Val(Text1) * 3600 + Val(Text2) * 60 + Val(Text3)
   Timer1.Enabled = True
End Sub
Private Sub Command4_Click()
   End
End Sub
Private Sub Form_Load()
   Timer1.Enabled = False
   start = False
   Timer1.Interval = 1000
   Label5.BackColor = vbYellow
   Label1.Caption = "小时"
   Label2.Caption = "分"
   Label3.Caption = "秒"
   Label4.Caption = "倒计时"
   Label5.Caption = ""
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Command1.Caption = "开始"
   Command2.Caption = "暂停"
   Command3.Caption = "重新开始"
   Command4.Caption = "退出"
   Command3.Enabled = False
End Sub
Private Sub Timer1_Timer()
   If t = 0 Then
      Timer1.Enabled = False
      MsgBox ("时间到")
      start = False
   Else
      t = t - 1
   End If
   Label5.Caption = Format(Trim(Str(t  3600)),"00") & ":" & Format(Trim(Str((t Mod 3600)  60)),"00") & ":" & Format(Trim(Str(t Mod 3600) Mod 60),"00")
End Sub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读