PPT制作的年会抽奖程序(作弊版本)

PPT界面截图

Public a, b, v As Integer
Private Sub CommandButton1_Click()
b = 0
CommandButton2.Enabled = True
CommandButton1.Enabled = False

If OptionButton1.Value = True Then
    v = 1
    TextBox3.Text = TextBox3.Text + "【特等奖1名】" + Chr(10)
ElseIf OptionButton2.Value = True Then
    v = 2
    TextBox3.Text = TextBox3.Text + "【一等奖2名】" + Chr(10)
ElseIf OptionButton3.Value = True Then
    v = 3
    TextBox3.Text = TextBox3.Text + "【二等奖3名】" + Chr(10)
ElseIf OptionButton4.Value = True Then
    v = 10
    TextBox3.Text = TextBox3.Text + "【三等奖10名】" + Chr(10)
ElseIf OptionButton5.Value = True Then
    v = 30
    TextBox3.Text = TextBox3.Text + "【幸运奖30名】" + Chr(10)
End If

Randomize (Timer)
Do While True
a = 1 + Int(Rnd() * 95)
Label1.Caption = a

Dim Savetime As Single
Savetime = Timer
While Timer < Savetime + 0.005
DoEvents
Wend

If b = 1 Then
    Exit Do
End If
Loop
End Sub

Private Sub CommandButton2_Click()

b = 1
Dim jc, zuhe As Variant
Dim i, j, k, bo As Integer
Dim arr(100) As Integer

CommandButton4.Enabled = True
CommandButton2.Enabled = False

If OptionButton1.Value = True Or OptionButton2.Value = True Or OptionButton3.Value = True Then
    jc = Split(TextBox2.Text, ",")
    c_jc = UBound(jc)

    If v - 1 < c_jc Then

For i = 0 To v - 1
    Randomize (Timer)

    bo = Int(Rnd() * c_jc) 

    TextBox1.Text = TextBox1.Text + jc(bo) + ", "

    Label1.Caption = jc(bo)

    For j = bo To c_jc - 1
        jc(j) = jc(j + 1)
    Next j

    c_jc = c_jc - 1
    TextBox2.Text = ""
    For k = 0 To c_jc - 1
        TextBox2.Text = TextBox2.Text + jc(k) + ","
    Next k
    TextBox2.Text = TextBox2.Text + jc(c_jc)

    Dim Savetime As Single
    Savetime = Timer
    While Timer < Savetime + 0.5
    DoEvents
    Wend
Next
End If

ElseIf OptionButton4.Value = True Then
    jc = Split(TextBox4.Text, ",")
    c_jc = UBound(jc)
    If v - 1 < c_jc Then

        For i = 0 To v - 1 
            Randomize (Timer)

            bo = Int(Rnd() * c_jc)

            TextBox1.Text = TextBox1.Text + jc(bo) + ", "

            Label1.Caption = jc(bo)

            For j = bo To c_jc - 1
                jc(j) = jc(j + 1)

            Next j

            c_jc = c_jc - 1
            TextBox4.Text = ""

            For k = 0 To c_jc - 1 
                TextBox4.Text = TextBox4.Text + jc(k) + ","
            Next k
            TextBox4.Text = TextBox4.Text + jc(c_jc)

            Dim Savetime2 As Single
            Savetime2 = Timer
            While Timer < Savetime2 + 0.5
            DoEvents
            Wend
        Next
    End If
ElseIf OptionButton5.Value = True Then
    TextBox5.Text = TextBox4.Text + "," + TextBox2.Text
    jc = Split(TextBox5.Text, ",")
    c_jc = UBound(jc)
    If v - 1 < c_jc Then

        For i = 0 To v - 1
            Randomize (Timer)

            bo = Int(Rnd() * c_jc)

            TextBox1.Text = TextBox1.Text + jc(bo) + ", "

            Label1.Caption = jc(bo)

            For j = bo To c_jc - 1
                jc(j) = jc(j + 1)

            Next j

            c_jc = c_jc - 1
            TextBox5.Text = ""

            For k = 0 To c_jc - 1
                TextBox5.Text = TextBox5.Text + jc(k) + ","
            Next k
            TextBox5.Text = TextBox5.Text + jc(c_jc)
            Dim Savetime3 As Single
            Savetime3 = Timer
            While Timer < Savetime3 + 0.5
            DoEvents
            Wend
        Next
    End If

End If

End Sub

Private Sub CommandButton3_Click()
TextBox1.Text = ""
TextBox3.Text = ""
TextBox5.Text = ""
TextBox4.Text = "4,5,6,7,8,22,23,25,27,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,65,66,67,69,70,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86"
TextBox2.Text = "97,71,3,2,1,18,19,17,20,14,16,15,13,9,12,11,10,26,31,24,21,63,64,62,28,29,68"
CommandButton4.Enabled = False
CommandButton2.Enabled = False
CommandButton1.Enabled = True
Label1.Caption = ""
End Sub

Private Sub CommandButton4_Click()
CommandButton1.Enabled = True
CommandButton4.Enabled = False
TextBox3.Text = TextBox3.Text + TextBox1.Text + Chr(10) + Chr(10)
TextBox1.Text = ""
End Sub
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部