3个回答
展开全部
只要在窗体中做二个命令按钮、一个标签和一个定时器对象,复制以下代码,就可以运行了:
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Command1.Caption = "暂停"
Timer1.Enabled = True
Else
Command1.Caption = "开始"
Timer1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Label1.FontSize = 50
Timer1.Interval = 50
Timer1.Enabled = False
Command1.Caption = "开始"
Command2.Caption = "结束"
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Int(Rnd * 50) + 1
End Sub
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Command1.Caption = "暂停"
Timer1.Enabled = True
Else
Command1.Caption = "开始"
Timer1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Label1.FontSize = 50
Timer1.Interval = 50
Timer1.Enabled = False
Command1.Caption = "开始"
Command2.Caption = "结束"
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Int(Rnd * 50) + 1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询