Dim i As Integer, cont As Integer
Dim croce As Boolean, flag As Boolean
Dim nome1 As String
Dim nome2 As String
Private Sub Check1_Click()
If Check1.Value = 1 Then
flag = True
Else
flag = False
End If
End Sub
Private Sub cmdcanc_Click()
suono.FileName = App.Path & "\bonus.wav"
For i = 0 To 8
lblm(i).Caption = ""
Next i
croce = False
lblo.Visible = True
lblx.Visible = False
cont = 0
End Sub
Private Sub Cmdmossa_Click()
Form1.MousePointer = 2
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "verde" Then
Form1.BackColor = &H80FF80
End If
If Combo1.Text = "giallo" Then
Form1.BackColor = vbYellow
End If
If Combo1.Text = "bianco" Then
Form1.BackColor = vbWhite
End If
If Combo1.Text = "grigio" Then
Form1.BackColor = vbGrayText
End If
If Combo1.Text = "bianco" Then
Form1.BackColor = vbWhite
End If
End Sub
Private Sub Combo2_Click()
If Combo2.Text = "giallo" Then
Line1.BorderColor = &HC0C0&
Line2.BorderColor = &HC0C0&
Line3.BorderColor = &HC0C0&
Line5.BorderColor = &HC0C0&
End If
If Combo2.Text = "grigio" Then
Line1.BorderColor = &H404040
Line2.BorderColor = &H404040
Line3.BorderColor = &H404040
Line5.BorderColor = &H404040
End If
If Combo2.Text = "grigio chiaro" Then
Line1.BorderColor = &HE0E0E0
Line2.BorderColor = &HE0E0E0
Line3.BorderColor = &HE0E0E0
Line5.BorderColor = &HE0E0E0
End If
If Combo2.Text = "nero" Then
Line1.BorderColor = vbBlack
Line2.BorderColor = vbBlack
Line3.BorderColor = vbBlack
Line5.BorderColor = vbBlack
End If
If Combo2.Text = "verde chiaro" Then
Line1.BorderColor = &HC0FFC0
Line2.BorderColor = &HC0FFC0
Line3.BorderColor = &HC0FFC0
Line5.BorderColor = &HC0FFC0
End If
End Sub
Private Sub Form_Load()
suono.FileName = App.Path & "\bonus.wav"
cont = 0
Form1.BackColor = &H80FF80
For i = 0 To 8
lblm(i).BackStyle = 0
Next i
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "esci") = vbYes Then
MsgBox "BY ALBERT KING!!!", vbExclamation, "CREATORE"
End
Else
Cancel = True
End If
End Sub
Private Sub Label5_Click()
nome1 = InputBox("Giocatore 1 (Scrivi il tuo nome)", "Giocatore 1")
If nome1 <> "" Then
Label1.Caption = nome1 & " " & "x"
End If
nome2 = InputBox("Giocatore 2 (Scrivi il tuo nome)", "Giocatore 2")
If nome2 <> "" Then
label2.Caption = nome2 & " " & "o"
End If
End Sub
Private Sub lblm_Click(Index As Integer)
If flag Then
suono.FileName = App.Path & "\0_zlatnik.wav"
End If
If lblm(Index).Caption = "" Then
cont = cont + 1
If lblx.Visible = True Then
lblx.Visible = False
lblo.Visible = True
croce = True
Else
lblx.Visible = True
lblo.Visible = False
End If
If croce Then
lblm(Index).Caption = "o"
lblm(Index).ForeColor = vbBlue
lblo.Visible = True
lblx.Visible = False
croce = False
Else
lblm(Index).Caption = "x"
lblm(Index).ForeColor = vbRed
End If
If lblm(0).Caption = "o" And lblm(1).Caption = "o" And lblm(2).Caption = "o" Then
Line6.Visible = True
Line6.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
Line6.BorderColor = vbBlue
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line6.Visible = False
Next i
End If
If lblm(0).Caption = "x" And lblm(1).Caption = "x" And lblm(2).Caption = "x" Then
Line6.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line6.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line6.Visible = False
Next i
End If
If lblm(3).Caption = "o" And lblm(4).Caption = "o" And lblm(5).Caption = "o" Then
Line7.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line7.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", vbInformation, "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", vbInformation, "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line7.Visible = False
Next i
End If
If lblm(3).Caption = "x" And lblm(4).Caption = "x" And lblm(5).Caption = "x" Then
Line7.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line7.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line7.Visible = False
Next i
End If
If lblm(6).Caption = "o" And lblm(7).Caption = "o" And lblm(8).Caption = "o" Then
Line4.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line4.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line4.Visible = False
Next i
End If
If lblm(6).Caption = "x" And lblm(7).Caption = "x" And lblm(8).Caption = "x" Then
Line4.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line4.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line4.Visible = False
Next i
End If
If lblm(0).Caption = "o" And lblm(3).Caption = "o" And lblm(6).Caption = "o" Then
Line9.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line9.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line9.Visible = False
Next i
End If
If lblm(0).Caption = "x" And lblm(3).Caption = "x" And lblm(6).Caption = "x" Then
Line9.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line9.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line9.Visible = False
Next i
End If
If lblm(1).Caption = "o" And lblm(4).Caption = "o" And lblm(7).Caption = "o" Then
Line10.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line10.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line10.Visible = False
Next i
End If
If lblm(1).Caption = "x" And lblm(4).Caption = "x" And lblm(7).Caption = "x" Then
Line10.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line10.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", v, "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line10.Visible = False
Next i
End If
If lblm(2).Caption = "o" And lblm(5).Caption = "o" And lblm(8).Caption = "o" Then
Line11.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line11.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line11.Visible = False
Next i
End If
If lblm(2).Caption = "x" And lblm(5).Caption = "x" And lblm(8).Caption = "x" Then
Line11.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line11.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line11.Visible = False
Next i
End If
If lblm(0).Caption = "o" And lblm(4).Caption = "o" And lblm(8).Caption = "o" Then
Line13.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line13.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", v, "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line13.Visible = False
Next i
End If
If lblm(0).Caption = "x" And lblm(4).Caption = "x" And lblm(8).Caption = "x" Then
Line13.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line13.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line13.Visible = False
Next i
End If
If lblm(2).Caption = "o" And lblm(4).Caption = "o" And lblm(6).Caption = "o" Then
Line12.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line12.BorderColor = vbBlue
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome2 <> "" Then
MsgBox nome2 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line12.Visible = False
Next i
End If
If lblm(2).Caption = "x" And lblm(4).Caption = "x" And lblm(6).Caption = "x" Then
Line12.Visible = True
suono.FileName = App.Path & "\winner.wav"
Line12.BorderColor = vbRed
cont = 0
croce = False
lblx.Visible = False
lblo.Visible = True
If nome1 <> "" Then
MsgBox nome1 & " ha fatto tris", , "Tris"
Else
MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
End If
For i = 0 To 8
lblm(i).Caption = ""
Line12.Visible = False
Next i
End If
End If
If cont = 9 Then
suono.FileName = App.Path & "\0_vexp.wav"
MsgBox "Nessuno ha fatto tris!!", , "info"
croce = False
lblx.Visible = False
lblo.Visible = True
For i = 0 To 8
lblm(i).Caption = ""
Next i
cont = 0
End If
End Sub
Private Sub mnucanc_Click()
suono.FileName = App.Path & "\bonus.wav"
For i = 0 To 8
lblm(i).Caption = ""
Next i
croce = False
lblo.Visible = True
lblx.Visible = False
cont = 0
End Sub
Private Sub mnuesci_Click()
Dim ris As Integer
ris = MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "Esci")
If ris = vbYes Then
MsgBox "BY ALBERT KING!!!", vbExclamation, "CREATORE"
End
End If
End Sub
Private Sub mnunome_Click()
nome1 = InputBox("Giocatore 1 (Scrivi il tuo nome)", "Giocatore 1")
If nome1 <> "" Then
Label1.Caption = nome1 & " " & "x"
End If
nome2 = InputBox("Giocatore 2 (Scrivi il tuo nome)", "Giocatore 2")
If nome2 <> "" Then
label2.Caption = nome2 & " " & "x"
End If
End Sub