📄 form1.frm
字号:
If num_prize < 3 And num_times = 1 Then Label11.Caption = "三等奖"
If num_prize = 3 And num_times = 1 Then Label11.Caption = "二等奖"
If num_prize = 4 And num_times = 1 Then Label11.Caption = "一等奖"
If (num_prize = 5 Or num_prize = 6) And num_times = 2 Then Label11.Caption = "三等奖"
If num_prize = 7 And num_times = 2 Then Label11.Caption = "二等奖"
If (num_prize = 8 Or num_prize = 9) And num_times = 3 Then Label11.Caption = "三等奖"
If num_prize = 10 And num_times = 3 Then Label11.Caption = "二等奖"
If num_prize = 11 And num_times = 3 Then Label11.Caption = "一等奖"
If num_times > 3 Then Label11.Caption = ""
Label11.Visible = True
Label4.Caption = ""
Label1.Caption = "正在抽取幸运之星"
Timer2.Enabled = True
i = i + 1
m = m + 1
Exit Sub
End If
If i = 1 And m = 2 And KeyCode = 32 Then
n = 2
i = i + 1
Label4.Caption = ""
Label1.Caption = "正在抽取幸运之星"
If num_prize < 3 And num_times = 1 Then Label11.Caption = "三等奖"
If num_prize = 3 And num_times = 1 Then Label11.Caption = "二等奖"
If num_prize = 4 And num_times = 1 Then Label11.Caption = "一等奖"
If (num_prize = 5 Or num_prize = 6) And num_times = 2 Then Label11.Caption = "三等奖"
If num_prize = 7 And num_times = 2 Then Label11.Caption = "二等奖"
If (num_prize = 8 Or num_prize = 9) And num_times = 3 Then Label11.Caption = "三等奖"
If num_prize = 10 And num_times = 3 Then Label11.Caption = "二等奖"
If num_prize = 11 And num_times = 3 Then Label11.Caption = "一等奖"
If num_times > 3 Then Label11.Caption = ""
Label11.Visible = True
Label4.Caption = ""
Timer2.Enabled = True
Timer1.Enabled = True
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
If num_prize > 4 And num_times = 1 Then
'num_prize = num_prize - 1
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label8.Caption = "一等奖: " & Format(a(4), "000")
Label9.Caption = "二等奖: " & Format(a(3), "000")
Label10.Caption = "三等奖: " & Format(a(1), "000") & "、" & Format(a(2), "000")
Label4.Caption = ""
'Label4.Visible = False
Label8.Visible = True
Label9.Visible = True
Label10.Visible = True
Label11.Visible = False
Exit Sub
End If
If num_prize > 7 And num_times = 2 Then
'num_prize = num_prize - 1
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label9.Caption = "二等奖: " & Format(a(7), "000")
Label10.Caption = "三等奖: " & Format(a(5), "000") & "、" & Format(a(6), "000")
Label9.Visible = True
Label10.Visible = True
Label11.Visible = False
Label4.Caption = ""
Exit Sub
End If
If num_prize > 11 And num_times = 3 Then
' num_prize = num_prize - 1
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label8.Caption = "一等奖: " & Format(a(11), "000")
Label9.Caption = "二等奖: " & Format(a(10), "000")
Label10.Caption = "三等奖: " & Format(a(8), "000") & "、" & Format(a(9), "000")
Label4.Caption = ""
'Label4.Visible = False
Label8.Visible = True
Label9.Visible = True
Label10.Visible = True
Label11.Visible = False
Exit Sub
End If
'num_prize = num_prize - 1
Exit Sub
End If
If i = 2 And KeyCode = 32 Then
n = 1
Label11.Visible = False
If num_prize < 3 And num_times = 1 Then Label1.Caption = "幸运之星(三等奖)"
If num_prize = 3 And num_times = 1 Then Label1.Caption = "幸运之星(二等奖)"
If num_prize = 4 And num_times = 1 Then Label1.Caption = "幸运之星(一等奖)"
If (num_prize = 5 Or num_prize = 6) And num_times = 2 Then Label1.Caption = "幸运之星(三等奖)"
If num_prize = 7 And num_times = 2 Then Label1.Caption = "幸运之星(二等奖)"
If (num_prize = 8 Or num_prize = 9) And num_times = 3 Then Label1.Caption = "幸运之星(三等奖)"
If num_prize = 10 And num_times = 3 Then Label1.Caption = "幸运之星(二等奖)"
If num_prize = 11 And num_times = 3 Then Label1.Caption = "幸运之星(一等奖)"
If num_prize > 4 And num_times = 1 Then
'num_prize = 4
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label4.Caption = ""
Exit Sub
End If
If num_prize > 7 And num_times = 2 Then
' num_prize = 7
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label4.Caption = ""
Exit Sub
End If
If num_prize > 11 And num_times = 3 Then
Timer1.Enabled = False
Timer2.Enabled = False
num.Caption = "SIA"
MMControl1.Command = "close"
Label1.Caption = " 本次抽奖结束"
Label4.Caption = ""
Exit Sub
End If
num_prize = num_prize + 1
Label4.Caption = Format(Val(num.Caption), "000")
num.Caption = Format(Val(Label4.Caption), "000")
Timer2.Enabled = False
MMControl2.Notify = False
MMControl2.Wait = True
MMControl2.Shareable = False
If Not (MMControl2.Mode = mciModeNotOpen) Then
MMControl2.Command = "close"
End If
MMControl2.DeviceType = "waveaudio"
MMControl2.FileName = "024.wav"
MMControl2.Command = "Open"
MMControl2.Command = "Play"
i = i - 1
a(number) = Val(num.Caption)
number = number + 1
'If number = 12 Then number = 1
Timer1.Enabled = False
MMControl1.Command = "close"
'OLE1.Action = 9
End If
If KeyCode = 27 And Label9.Visible = False And n = 1 Then
n = 2
a(number_back) = Val(num.Caption)
number_back = number_back - 1
number = number - 1
num_prize = num_prize - 1
i = i + 1
Label4.Caption = ""
Label1.Caption = "重新抽取幸运之星"
If num_prize < 3 And num_times = 1 Then Label11.Caption = "三等奖"
If num_prize = 3 And num_times = 1 Then Label11.Caption = "二等奖"
If num_prize = 4 And num_times = 1 Then Label11.Caption = "一等奖"
If (num_prize = 5 Or num_prize = 6) And num_times = 2 Then Label11.Caption = "三等奖"
If num_prize = 7 And num_times = 2 Then Label11.Caption = "二等奖"
If (num_prize = 8 Or num_prize = 9) And num_times = 3 Then Label11.Caption = "三等奖"
If num_prize = 10 And num_times = 3 Then Label11.Caption = "二等奖"
If num_prize = 11 And num_times = 3 Then Label11.Caption = "一等奖"
Label11.Visible = True
Label4.Caption = ""
Timer2.Enabled = True
Timer1.Enabled = True
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
Private Sub Form_Load()
Label7.Visible = False
Label8.Visible = False
Label9.Visible = False
Label10.Visible = False
Label11.Visible = False
total_num.Visible = False
Command1.Visible = False
Label5.Left = Width + 50
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
Timer1.Enabled = False
Timer1.Interval = 4000
Timer1.Enabled = True
Timer2.Enabled = False
Timer2.Interval = 10
Timer3.Enabled = False
Timer3.Interval = 103
Timer3.Enabled = True
total_num = Val(total_num.Text)
i = 1
m = 1
n = 1
flag = 1
num_prize = 1
num_times = 1
number = 1
number_back = 30
num.Caption = "SIA"
Label1.Caption = " 元旦快乐 "
For j = 1 To 12
a(j) = 0
Next
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 And flag_button = 2 Then
flag_button = 1
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
total_num.Visible = False
Label7.Visible = False
Command1.Visible = False
End If
If Button = 2 Then
Timer1.Enabled = False
MMControl1.Command = "close"
flag_button = 2
total_num.Visible = True
Label7.Visible = True
Command1.Visible = True
End If
End Sub
Private Sub Form_Resize()
If WindowState = 1 Then
Timer1.Enabled = False
MMControl1.Command = "close"
End If
If WindowState = 2 Then
Label8.Visible = False
Label9.Visible = False
Label10.Visible = False
Label11.Visible = False
num.Caption = "SIA"
Label1.Caption = " 元旦快乐 "
Label4.Caption = ""
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
m = 1
i = 1
End If
End Sub
Private Sub Timer1_Timer()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
If Not (MMControl1.Mode = mciModeNotOpen) Then
MMControl1.Command = "close"
End If
MMControl1.DeviceType = "waveaudio"
MMControl1.FileName = "defBKSound.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub
Private Sub Timer2_Timer()
Dim sj1
'flag = 1
'Do While flag = 1
Randomize
sj1 = Int(Rnd * total_num) + 1
For j = 1 To 30
If a(j) = sj1 Then Exit Sub
Next
' If flag2 = 1 Then Exit Do
' End If
'Loop
num.Caption = Format(sj1, "000")
End Sub
Private Sub Timer3_Timer()
If Label5.Left < 0 - Label5.Width Then '如果文字移到窗体左端之外,
Label5.Left = Width + 50 '则将它的位置立即移回到初始位置
End If
Label5.Left = Label5.Left - 100
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -