當前位置:編程學習大全網 - 網站源碼 - 現在需要壹個VB程序,給我代碼就可以了。用於倒計時,時間為5分鐘,顯示分 秒 毫秒

現在需要壹個VB程序,給我代碼就可以了。用於倒計時,時間為5分鐘,顯示分 秒 毫秒

窗體放壹個Label和壹個Timer控件

Dim m As Integer, s As Integer, ms As Integer

Private Sub Form_Load()

Label1.Font.Size = 50

Timer1.Interval = 10

Timer1.Enabled = True

m = 5

End Sub

Private Sub Timer1_Timer()

If ms > 0 Then

ms = ms - 1

Else

ms = 99

If s > 0 Then

s = s - 1

Else

s = 59

If m > 0 Then

m = m - 1

Else

ms = 0

s = 0

End If

End If

End If

If m = 0 And s = 0 And ms = 0 Then

Label1.Caption = "GAME OVER"

Beep

Timer1.Enabled = False

Else

Label1.Caption = m & ":" & Format(s, "00") & ":" & Format(ms, "00")

End If

End Sub

  • 上一篇:現貨原油常用的技術指標有哪些呢?
  • 下一篇:通達信短期公式源代碼選股
  • copyright 2024編程學習大全網