帮忙设计一个vb秒表设计程序,求高手帮帮忙,谢谢啦~~
展开全部
Dim i,h,m,s As Integer
Private Sub Form_Load()
Form1.Caption = "在此输入你的学号和姓名"
Label1.Autosize = True
Label1.Caption = 0
Timer1.Interval = 1000 '1000毫秒,即1秒
Timer1.Enabled = False
Command1.Caption = "计时开始"
End Sub
Private Sub Command1_Click()
If Command1.Caption = "计时开始" Then
Timer1.Enabled = True
Command1.Caption = "停止"
Else
Timer1.Enabled = False
Command1.Caption = "计时开始"
h = i Mod 3600 '整除运算,1小时3600秒
m = (i-h*3600) Mod 60
s = i-h*3600-m*60
Msgbox "一共运行了" & h & "小时" & "m" & "分钟" & s & "秒"
End If
End Sub
Private Sub Timer1_Timer()
i = Label1.Caption
i = i + 1 '每次秒数加1
Label1.Caption = i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询