2011年3月1日 星期二

網路核心程式設計-Week2-樂透擲杯


Dim count1 As Integer
Private Sub Command1_Click()


Dim num, i, j, certain(5) As Integer
Command2.Enabled = True
count1 = 0
Text1.Text = ""
Text2.Text = ""
Label1 = ""
Randomize Timer
For i = 0 To 5
rechoose:
certain(i) = Int(Rnd * 49) + 1
For j = 0 To i - 1
If certain(i) = certain(j) Then
GoTo rechoose
End If
Next j
Text1 = Text1 & " " & certain(i)
Next i

End Sub

Private Sub Command2_Click()

x = Int(Rnd() * 4 + 1)


If x = 1 Then
Picture1(0).Visible = True
Picture2.Visible = False
Picture3.Visible = False
count1 = count1 + 1
ElseIf x = 2 Then
Picture1(0).Visible = False
Picture2.Visible = True
Picture3.Visible = False
Command2.Enabled = False
ElseIf x = 3 Then
Picture1(0).Visible = True
Picture2.Visible = False
Picture3.Visible = False
count1 = count1 + 1
Else
Picture1(0).Visible = False
Picture2.Visible = False
Picture3.Visible = True
Command2.Enabled = False
End If

Text2.Text = count1
If count1 = 3 Then

Text1.ForeColor = &HFF&
End If


End Sub

Private Sub Form_Load()
Picture1(0).Visible = False
Picture2.Visible = False
Picture3.Visible = False
End Sub

Private Sub Label1_Click()

End Sub

沒有留言:

張貼留言