4个回答
展开全部
1、添加一个“label控件”命名为label
2、添加一个“timer控件”命名为timer1
3、设置“timer1”的“Interval属性”为1000
使用到的代码:
Dim Hour As Integer '小时
Dim Min As Integer '分钟
Dim Sec As Integer '秒
Private Sub Form_Load()
Hour = 0
Min = 0
Sec = 0
Label1.Caption = "00 : 00 : 00"
End Sub
Private Sub Timer1_Timer()
Dim strHour As String
Dim strMin As String
Dim strSec As String
Sec = Sec + 1
If Sec >= 60 Then
Sec = 0
Min = Min + 1
If Min >= 60 Then
Min = 0
Hour = Hour + 1
If Hour >= 24 Then
Hour = 0
End If
End If
End If
If Hour < 10 Then
strHour = "0" & Hour
Else
strHour = Hour
End If
If Min < 10 Then
strMin = "0" & Min
Else
strMin = Min
End If
If Sec < 10 Then
strSec = "0" & Sec
Else
strSec = Sec
End If
Label1.Caption = strHour & " : " & strMin & " : " & strSec
End Sub
展开全部
Private Sub Form_Load()
Timer1.Interval = 1000
Label1.Caption = Time
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Timer1.Interval = 1000
Label1.Caption = Time
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1楼正解
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询