怎么用vb做一个抽奖程序
发布网友
发布时间:2022-04-21 22:35
我来回答
共1个回答
热心网友
时间:2023-12-20 19:38
只要在窗体中做二个命令按钮、一个标签和一个定时器对象,复制以下代码,就可以运行了:
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