Text3(0) = ""
Text3(1) = ""
Text3(2) = ""
Text3(3) = ""
Text3(4) = ""
Text3(5) = ""
Text3(6) = ""
Text3(7) = ""
Text3(8) = ""
Randomize
For a = 0 To 2
For n = 10 To 130
x = Int(Rnd * n) - 30 '产生随机整数
Next n
For b = -15 To 30
y = x - b
Next b
If 80 <x Or 0 <x <20 Or -20 <x <0 Or x <-80 Or x = 0 Then
Text1(a) = ""
End If
If 20 <x <80 Or -80 <x <-20 Then
Text1(a) = y * 10 ^ -2
End If
If Text2(0) = "" Then
Text2(0) = 0
Text2(1) = 0
Text2(2) = 0
Text1(a) = 0
End If
Next a
For m = 3 To 5
For n = 10 To 130
x = Int(Rnd * n) - 30 '产生随机整数
Next n
For b = -15 To 30
y = x - b
Next b
If 80 <x Or 0 <x <20 Or -20 <x <0 Or x <-80 Or x = 0 Then
Text1(m) = ""
End If
If Text2(3) = "" Then
Text2(3) = 0
Text2(4) = 0
Text2(5) = 0
Text1(m) = 0
End If
If 20 <x <80 Or -80 <x <-20 Then
Text1(m) = y * 10 ^ -2
End If
Next m
For k = 6 To 8
For n = 10 To 130
x = Int(Rnd * n) - 30 '产生随机整数
Next n
For b = -15 To 30
y = x - b
Next b
If 80 <x Or 0 <x <20 Or -20 <x <0 Or x <-80 Or x = 0 Then
Text1(k) = ""
End If
If 20 <x <80 Or -80 <x <-20 Then
Text1(k) = y * 10 ^ -2
End If
If Text2(6) = "" Then
Text2(6) = 0
Text2(7) = 0
Text2(8) = 0
Text1(k) = 0
End If
Next k
End Sub
Private Sub Command2_Click()
If Text1(0) <0 Then
Text1(0) = -Text1(0)
Text3(0) = Text2(0) - Text1(0)
Else
Text3(0) = Text2(0) + Text1(0)
End If
If Text1(1) <0 Then
Text1(1) = -Text1(1)
Text3(1) = Text2(1) - Text1(1)
Else
Text3(1) = Text2(1) + Text1(1)
End If
If Text1(2) <0 Then
Text1(2) = -Text1(2)
Text3(2) = Text2(2) - Text1(2)
Else
Text3(2) = Text2(2) + Text1(2)
End If
If Text1(3) <0 Then
Text1(3) = -Text1(3)
Text3(3) = Text2(3) - Text1(3)
Else
Text3(3) = Text2(3) + Text1(3)
End If
If Text1(4) <0 Then
Text1(4) = -Text1(4)
Text3(4) = Text2(4) - Text1(4)
Else
Text3(4) = Text2(4) + Text1(4)
End If
If Text1(5) <0 Then
Text1(5) = -Text1(5)
Text3(5) = Text2(5) - Text1(5)
Else
Text3(5) = Text2(5) + Text1(5)
End If
If Text1(6) <0 Then
Text1(6) = -Text1(6)
Text3(6) = Text2(6) - Text1(6)
Else
Text3(6) = Text2(6) + Text1(6)
End If
If Text1(7) <0 Then
Text1(7) = -Text1(7)
Text3(7) = Text2(7) - Text1(7)
Else
Text3(7) = Text2(7) + Text1(7)
End If
If Text1(8) <0 Then
Text1(8) = -Text1(8)
Text3(8) = Text2(8) - Text1(8)
Else
Text3(8) = Text2(8) + Text1(8)
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
Text2(0) = ""
Text2(1) = ""
Text2(2) = ""
Text2(3) = ""
Text2(4) = ""
Text2(5) = ""
Text2(6) = ""
Text2(7) = ""
Text2(8) = ""
Text3(0) = ""
Text3(1) = ""
Text3(2) = ""
Text3(3) = ""
Text3(4) = ""
Text3(5) = ""
Text3(6) = ""
Text3(7) = ""
Text3(8) = ""
Text1(0) = ""
Text1(1) = ""
Text1(2) = ""
Text1(3) = ""
Text1(4) = ""
Text1(5) = ""
Text1(6) = ""
Text1(7) = ""
Text1(8) = ""
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End
End Sub
这是我以前做的相当于抽奖的程序你可以查考
这是一个转盘 转到的位置是随机的 具体奖品需要你自己定 我就不帮你了..... 这一句 If c >95 Then Timer1.Interval = 0 这个95 改的越小 停的越快,转到的位置重复的几率也就越大 . 代码细看看, 数值都是活的 可以根据自己需要改.'添加控件 timer1 command1 line1
Dim x1%, y1%
Dim a As String
Private Sub Command1_Click()
a = 0
Timer1.Interval = 50
End Sub
Private Sub form_load()
Me.AutoRedraw = True
x1 = Me.Width \ 2
y1 = (Me.Height - 405) \ 2
Line1.x1 = x1: Line1.y1 = y1
Me.DrawWidth = 5
Me.Circle (x1, y1), 3000
Line1.BorderWidth = 5
Line1.BorderColor = QBColor(14)
End Sub
Private Sub Timer1_Timer()
Randomize
c = Int((100) * Rnd + 1)
a = a + 1
If a >24 Then Timer1.Interval = 100
If a >40 Then Timer1.Interval = 200
If a >48 Then
Timer1.Interval = 300
If c >95 Then Timer1.Interval = 0
End If
b = (3.14 / 8) * a
Line1.X2 = Line1.x1 + (3000 * Sin(b))
Line1.Y2 = Line1.y1 - (3000 * Cos(b))
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)