用VB编写小游戏计时器的问题!高手快进啊!55555
想给编的游戏加个计时器,就是在按"开始"按钮的时候TextBox或Label中能显示游戏的时间,例如01:30,即玩了1分30秒,请问怎么实现?谁给个稍微具体点的思路和代...
想给编的游戏加个计时器,就是在按"开始"按钮的时候TextBox或Label中能显示游戏的时间,例如01:30,即玩了1分30秒,请问怎么实现?
谁给个稍微具体点的思路和代码?拜托啦!有急用!
我原来的算法有问题:
Private Sub Timer1_Timer()
'计时器
Static SS, MM, MT, ST As Integer
If SS > 59 Then '秒进分
MM = MM + 1: SS = 0
End If
If SS < 10 Then '当秒或分小于十时补前面一个字符“0”
If SS = 0 Then
ST = "00"
Else
ST = "0" & SS
End If
Else
ST = SS
End If
If MM < 10 Then
If MM = 0 Then
MT = "00"
Else
MT = "0" & MM
End If
Else
MT = MM
End If
SS = SS + 1 '秒进一
Text1.Text = "Time" & MT & ":" & ST
DoEvents
End Sub
拜托大家帮帮忙吧!有急用!
感激不尽! 展开
谁给个稍微具体点的思路和代码?拜托啦!有急用!
我原来的算法有问题:
Private Sub Timer1_Timer()
'计时器
Static SS, MM, MT, ST As Integer
If SS > 59 Then '秒进分
MM = MM + 1: SS = 0
End If
If SS < 10 Then '当秒或分小于十时补前面一个字符“0”
If SS = 0 Then
ST = "00"
Else
ST = "0" & SS
End If
Else
ST = SS
End If
If MM < 10 Then
If MM = 0 Then
MT = "00"
Else
MT = "0" & MM
End If
Else
MT = MM
End If
SS = SS + 1 '秒进一
Text1.Text = "Time" & MT & ":" & ST
DoEvents
End Sub
拜托大家帮帮忙吧!有急用!
感激不尽! 展开
展开全部
private lngAllSecond as long
private intHour as integer
private intMin as integer
private intSecond as integer
Private Sub Timer1_Timer()
intHour =int(lngAllSecond /3600)
intMin = int(lngAllSecond /60)
intSecond = int(lngAllSecond mod 60)
Text1.Text =intHour & ":" & intMin & ":" & intSecond
lngAllSecond =lngAllSecond +1
End Sub
private intHour as integer
private intMin as integer
private intSecond as integer
Private Sub Timer1_Timer()
intHour =int(lngAllSecond /3600)
intMin = int(lngAllSecond /60)
intSecond = int(lngAllSecond mod 60)
Text1.Text =intHour & ":" & intMin & ":" & intSecond
lngAllSecond =lngAllSecond +1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询