音乐结尾爆炸音效:恳请大家帮帮我吧!

来源:百度文库 编辑:高校问答 时间:2024/05/12 01:09:32
编写一个竞赛用的秒表程序,按S键开始计时,按E键停止计时。
谢谢您的回答,我想用C编写,好吗,谢谢!

用vb 编程
一个 timer 控件 一个 lable 控件 四个 command 控件
Private Sub Command1_Click() '开始记数
Timer1.Enabled = True

End Sub

Private Sub Command2_Click() '暂停
Timer1.Enabled = False
End Sub

Private Sub Command3_Click() '退出
End

End Sub

Private Sub Command4_Click() '清零
Label1.Caption = 0
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)'键盘控制
If KeyCode = vbKeyS Then Timer1.Enabled = True '计数
If KeyCode = vbKeyE Then Timer1.Enabled = False '暂停
If KeyCode = vbKeyC Then Label1.Caption = 0 '清零
If KeyCode = vbKeyQ Then Unload Me '退出
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000 '时间为1000毫秒
Label1.Caption = 0
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Val(Label1.Caption) + 1
End Sub

一个Label、一个Timer

Dim s As Single

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = Asc("S") Then
Timer1.Enabled = True
s = 0 '若计时不需要清零,可以将这句删去。
ElseIf KeyCode = Asc("E") Then
Timer1.Enabled = False
End If
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
Timer1.Interval = 10
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Format(s, "00.00")
s = s + 0.01
End Sub