Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
tris - Form1.frm

Form1.frm

Caricato da: Albertking82
Scarica il programma completo

  1. Dim i As Integer, cont As Integer
  2. Dim croce As Boolean, flag As Boolean
  3. Dim nome1 As String
  4. Dim nome2 As String
  5. Private Sub Check1_Click()
  6.        If Check1.Value = 1 Then
  7.         flag = True
  8.        Else
  9.         flag = False
  10.        End If
  11. End Sub
  12.  
  13. Private Sub cmdcanc_Click()
  14. suono.FileName = App.Path & "\bonus.wav"
  15.            For i = 0 To 8
  16.               lblm(i).Caption = ""
  17.            Next i
  18.  croce = False
  19.  lblo.Visible = True
  20.  lblx.Visible = False
  21.  cont = 0
  22. End Sub
  23.  
  24. Private Sub Cmdmossa_Click()
  25.   Form1.MousePointer = 2
  26. End Sub
  27.  
  28. Private Sub Combo1_Click()
  29.     If Combo1.Text = "verde" Then
  30.          Form1.BackColor = &H80FF80
  31.     End If
  32.          If Combo1.Text = "giallo" Then
  33.             Form1.BackColor = vbYellow
  34.          End If
  35.             If Combo1.Text = "bianco" Then
  36.                Form1.BackColor = vbWhite
  37.             End If
  38.                 If Combo1.Text = "grigio" Then
  39.                    Form1.BackColor = vbGrayText
  40.                 End If
  41.                   If Combo1.Text = "bianco" Then
  42.                       Form1.BackColor = vbWhite
  43.                   End If
  44. End Sub
  45.  
  46. Private Sub Combo2_Click()
  47.       If Combo2.Text = "giallo" Then
  48.             Line1.BorderColor = &HC0C0&
  49.             Line2.BorderColor = &HC0C0&
  50.             Line3.BorderColor = &HC0C0&
  51.             Line5.BorderColor = &HC0C0&
  52.       End If
  53.           If Combo2.Text = "grigio" Then
  54.                 Line1.BorderColor = &H404040
  55.                 Line2.BorderColor = &H404040
  56.                 Line3.BorderColor = &H404040
  57.                 Line5.BorderColor = &H404040
  58.           End If
  59.               If Combo2.Text = "grigio chiaro" Then
  60.                    Line1.BorderColor = &HE0E0E0
  61.                    Line2.BorderColor = &HE0E0E0
  62.                    Line3.BorderColor = &HE0E0E0
  63.                    Line5.BorderColor = &HE0E0E0
  64.               End If
  65.                   If Combo2.Text = "nero" Then
  66.                        Line1.BorderColor = vbBlack
  67.                        Line2.BorderColor = vbBlack
  68.                        Line3.BorderColor = vbBlack
  69.                        Line5.BorderColor = vbBlack
  70.                    End If
  71.                        If Combo2.Text = "verde chiaro" Then
  72.                              Line1.BorderColor = &HC0FFC0
  73.                              Line2.BorderColor = &HC0FFC0
  74.                              Line3.BorderColor = &HC0FFC0
  75.                              Line5.BorderColor = &HC0FFC0
  76.                         End If
  77.  
  78. End Sub
  79.  
  80. Private Sub Form_Load()
  81. suono.FileName = App.Path & "\bonus.wav"
  82.  cont = 0
  83.  Form1.BackColor = &H80FF80
  84.           For i = 0 To 8
  85.               lblm(i).BackStyle = 0
  86.           Next i
  87. End Sub
  88.  
  89. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  90.       If MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "esci") = vbYes Then
  91.           MsgBox "BY ALBERT KING!!!", vbExclamation, "CREATORE"
  92.           End
  93.       Else
  94.           Cancel = True
  95.       End If
  96. End Sub
  97.  
  98. Private Sub Label5_Click()
  99.  nome1 = InputBox("Giocatore 1 (Scrivi il tuo nome)", "Giocatore 1")
  100.           If nome1 <> "" Then
  101.              Label1.Caption = nome1 & "  " & "x"
  102.           End If
  103.  nome2 = InputBox("Giocatore 2 (Scrivi il tuo nome)", "Giocatore 2")
  104.               If nome2 <> "" Then
  105.                  label2.Caption = nome2 & "  " & "o"
  106.               End If
  107. End Sub
  108.  
  109. Private Sub lblm_Click(Index As Integer)
  110.     If flag Then
  111.        suono.FileName = App.Path & "\0_zlatnik.wav"
  112.     End If
  113.      If lblm(Index).Caption = "" Then
  114.         cont = cont + 1
  115.       If lblx.Visible = True Then
  116.          lblx.Visible = False
  117.          lblo.Visible = True
  118.          croce = True
  119.       Else
  120.          lblx.Visible = True
  121.          lblo.Visible = False
  122.       End If
  123.         If croce Then
  124.            lblm(Index).Caption = "o"
  125.            lblm(Index).ForeColor = vbBlue
  126.            lblo.Visible = True
  127.            lblx.Visible = False
  128.            croce = False
  129.         Else
  130.            lblm(Index).Caption = "x"
  131.            lblm(Index).ForeColor = vbRed
  132.         End If
  133.       If lblm(0).Caption = "o" And lblm(1).Caption = "o" And lblm(2).Caption = "o" Then
  134.           Line6.Visible = True
  135.           Line6.BorderColor = vbBlue
  136.           cont = 0
  137.           croce = False
  138.           lblx.Visible = False
  139.           lblo.Visible = True
  140.           Line6.BorderColor = vbBlue
  141.         If nome2 <> "" Then
  142.            MsgBox nome2 & " ha fatto tris", , "Tris"
  143.         Else
  144.            MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  145.         End If
  146.                    For i = 0 To 8
  147.                         lblm(i).Caption = ""
  148.                         Line6.Visible = False
  149.                    Next i
  150.       End If
  151.   If lblm(0).Caption = "x" And lblm(1).Caption = "x" And lblm(2).Caption = "x" Then
  152.    Line6.Visible = True
  153.    suono.FileName = App.Path & "\winner.wav"
  154.    Line6.BorderColor = vbRed
  155.    cont = 0
  156.    croce = False
  157.    lblx.Visible = False
  158.   lblo.Visible = True
  159.   If nome2 <> "" Then
  160.    MsgBox nome1 & " ha fatto tris", , "Tris"
  161.    Else
  162.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  163.    End If
  164.        For i = 0 To 8
  165.    lblm(i).Caption = ""
  166.    Line6.Visible = False
  167.    Next i
  168.   End If
  169.     If lblm(3).Caption = "o" And lblm(4).Caption = "o" And lblm(5).Caption = "o" Then
  170.   Line7.Visible = True
  171.   suono.FileName = App.Path & "\winner.wav"
  172.   Line7.BorderColor = vbBlue
  173.   cont = 0
  174.   croce = False
  175.   lblx.Visible = False
  176.   lblo.Visible = True
  177.    If nome2 <> "" Then
  178.    MsgBox nome2 & " ha fatto tris", vbInformation, "Tris"
  179.    Else
  180.    MsgBox "Il giocatore 2 ha fatto tris", vbInformation, "Tris"
  181.    End If
  182.       For i = 0 To 8
  183.    lblm(i).Caption = ""
  184.    Line7.Visible = False
  185.    Next i
  186.   End If
  187.   If lblm(3).Caption = "x" And lblm(4).Caption = "x" And lblm(5).Caption = "x" Then
  188.   Line7.Visible = True
  189.   suono.FileName = App.Path & "\winner.wav"
  190.   Line7.BorderColor = vbRed
  191.   cont = 0
  192.   croce = False
  193.   lblx.Visible = False
  194.   lblo.Visible = True
  195.    If nome1 <> "" Then
  196.    MsgBox nome1 & " ha fatto tris", , "Tris"
  197.    Else
  198.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  199.    End If
  200.      For i = 0 To 8
  201.    lblm(i).Caption = ""
  202.    Line7.Visible = False
  203.    Next i
  204.   End If
  205.       If lblm(6).Caption = "o" And lblm(7).Caption = "o" And lblm(8).Caption = "o" Then
  206.   Line4.Visible = True
  207.   suono.FileName = App.Path & "\winner.wav"
  208.   Line4.BorderColor = vbBlue
  209.   cont = 0
  210.   croce = False
  211.   lblx.Visible = False
  212.   lblo.Visible = True
  213.    If nome2 <> "" Then
  214.    MsgBox nome2 & " ha fatto tris", , "Tris"
  215.    Else
  216.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  217.    End If
  218.       For i = 0 To 8
  219.    lblm(i).Caption = ""
  220.    Line4.Visible = False
  221.    Next i
  222.   End If
  223.   If lblm(6).Caption = "x" And lblm(7).Caption = "x" And lblm(8).Caption = "x" Then
  224.   Line4.Visible = True
  225.   suono.FileName = App.Path & "\winner.wav"
  226.   Line4.BorderColor = vbRed
  227.   cont = 0
  228.   croce = False
  229.   lblx.Visible = False
  230.   lblo.Visible = True
  231.   If nome1 <> "" Then
  232.    MsgBox nome1 & " ha fatto tris", , "Tris"
  233.    Else
  234.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  235.    End If
  236.      For i = 0 To 8
  237.    lblm(i).Caption = ""
  238.    Line4.Visible = False
  239.    Next i
  240.   End If
  241.    If lblm(0).Caption = "o" And lblm(3).Caption = "o" And lblm(6).Caption = "o" Then
  242.   Line9.Visible = True
  243.   suono.FileName = App.Path & "\winner.wav"
  244.   Line9.BorderColor = vbBlue
  245.   cont = 0
  246.   croce = False
  247.   lblx.Visible = False
  248.   lblo.Visible = True
  249.   If nome2 <> "" Then
  250.    MsgBox nome2 & " ha fatto tris", , "Tris"
  251.    Else
  252.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  253.    End If
  254.       For i = 0 To 8
  255.    lblm(i).Caption = ""
  256.    Line9.Visible = False
  257.    Next i
  258.   End If
  259.   If lblm(0).Caption = "x" And lblm(3).Caption = "x" And lblm(6).Caption = "x" Then
  260.   Line9.Visible = True
  261.   suono.FileName = App.Path & "\winner.wav"
  262.   Line9.BorderColor = vbRed
  263.   cont = 0
  264.   croce = False
  265.   lblx.Visible = False
  266.   lblo.Visible = True
  267.    If nome1 <> "" Then
  268.    MsgBox nome1 & " ha fatto tris", , "Tris"
  269.    Else
  270.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  271.    End If
  272.      For i = 0 To 8
  273.    lblm(i).Caption = ""
  274.    Line9.Visible = False
  275.    Next i
  276.    End If
  277.      If lblm(1).Caption = "o" And lblm(4).Caption = "o" And lblm(7).Caption = "o" Then
  278.   Line10.Visible = True
  279.   suono.FileName = App.Path & "\winner.wav"
  280.   Line10.BorderColor = vbBlue
  281.   cont = 0
  282.   croce = False
  283.   lblx.Visible = False
  284.   lblo.Visible = True
  285.      If nome2 <> "" Then
  286.    MsgBox nome2 & " ha fatto tris", , "Tris"
  287.    Else
  288.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  289.    End If
  290.       For i = 0 To 8
  291.    lblm(i).Caption = ""
  292.    Line10.Visible = False
  293.    Next i
  294.   End If
  295.   If lblm(1).Caption = "x" And lblm(4).Caption = "x" And lblm(7).Caption = "x" Then
  296.   Line10.Visible = True
  297.   suono.FileName = App.Path & "\winner.wav"
  298.   Line10.BorderColor = vbRed
  299.   cont = 0
  300.   croce = False
  301.   lblx.Visible = False
  302.   lblo.Visible = True
  303.    If nome1 <> "" Then
  304.    MsgBox nome1 & " ha fatto tris", , "Tris"
  305.    Else
  306.    MsgBox "Il giocatore 1 ha fatto tris", v, "Tris"
  307.    End If
  308.      For i = 0 To 8
  309.    lblm(i).Caption = ""
  310.    Line10.Visible = False
  311.    Next i
  312.   End If
  313.        If lblm(2).Caption = "o" And lblm(5).Caption = "o" And lblm(8).Caption = "o" Then
  314.   Line11.Visible = True
  315.   suono.FileName = App.Path & "\winner.wav"
  316.   Line11.BorderColor = vbBlue
  317.   cont = 0
  318.   croce = False
  319.   lblx.Visible = False
  320.   lblo.Visible = True
  321.      If nome2 <> "" Then
  322.    MsgBox nome2 & " ha fatto tris", , "Tris"
  323.    Else
  324.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  325.    End If
  326.       For i = 0 To 8
  327.    lblm(i).Caption = ""
  328.    Line11.Visible = False
  329.    Next i
  330.   End If
  331.   If lblm(2).Caption = "x" And lblm(5).Caption = "x" And lblm(8).Caption = "x" Then
  332.   Line11.Visible = True
  333.   suono.FileName = App.Path & "\winner.wav"
  334.   Line11.BorderColor = vbRed
  335.   cont = 0
  336.   croce = False
  337.   lblx.Visible = False
  338.   lblo.Visible = True
  339.   If nome1 <> "" Then
  340.    MsgBox nome1 & " ha fatto tris", , "Tris"
  341.    Else
  342.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  343.    End If
  344.      For i = 0 To 8
  345.    lblm(i).Caption = ""
  346.    Line11.Visible = False
  347.    Next i
  348.   End If
  349.        If lblm(0).Caption = "o" And lblm(4).Caption = "o" And lblm(8).Caption = "o" Then
  350.   Line13.Visible = True
  351.   suono.FileName = App.Path & "\winner.wav"
  352.   Line13.BorderColor = vbBlue
  353.   cont = 0
  354.   croce = False
  355.   lblx.Visible = False
  356.   lblo.Visible = True
  357.      If nome2 <> "" Then
  358.    MsgBox nome2 & " ha fatto tris", v, "Tris"
  359.    Else
  360.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  361.    End If
  362.       For i = 0 To 8
  363.    lblm(i).Caption = ""
  364.    Line13.Visible = False
  365.    Next i
  366.   End If
  367.   If lblm(0).Caption = "x" And lblm(4).Caption = "x" And lblm(8).Caption = "x" Then
  368.   Line13.Visible = True
  369.   suono.FileName = App.Path & "\winner.wav"
  370.   Line13.BorderColor = vbRed
  371.   cont = 0
  372.   croce = False
  373.   lblx.Visible = False
  374.   lblo.Visible = True
  375.   If nome1 <> "" Then
  376.    MsgBox nome1 & " ha fatto tris", , "Tris"
  377.    Else
  378.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  379.    End If
  380.      For i = 0 To 8
  381.    lblm(i).Caption = ""
  382.    Line13.Visible = False
  383.    Next i
  384.   End If
  385.       If lblm(2).Caption = "o" And lblm(4).Caption = "o" And lblm(6).Caption = "o" Then
  386.   Line12.Visible = True
  387.   suono.FileName = App.Path & "\winner.wav"
  388.   Line12.BorderColor = vbBlue
  389.   cont = 0
  390.   croce = False
  391.   lblx.Visible = False
  392.   lblo.Visible = True
  393.     If nome2 <> "" Then
  394.    MsgBox nome2 & " ha fatto tris", , "Tris"
  395.    Else
  396.    MsgBox "Il giocatore 2 ha fatto tris", , "Tris"
  397.    End If
  398.       For i = 0 To 8
  399.    lblm(i).Caption = ""
  400.    Line12.Visible = False
  401.    Next i
  402.   End If
  403.   If lblm(2).Caption = "x" And lblm(4).Caption = "x" And lblm(6).Caption = "x" Then
  404.   Line12.Visible = True
  405.   suono.FileName = App.Path & "\winner.wav"
  406.   Line12.BorderColor = vbRed
  407.   cont = 0
  408.   croce = False
  409.   lblx.Visible = False
  410.   lblo.Visible = True
  411.   If nome1 <> "" Then
  412.    MsgBox nome1 & " ha fatto tris", , "Tris"
  413.    Else
  414.    MsgBox "Il giocatore 1 ha fatto tris", , "Tris"
  415.    End If
  416.      For i = 0 To 8
  417.    lblm(i).Caption = ""
  418.    Line12.Visible = False
  419.    Next i
  420.   End If
  421.   End If
  422.   If cont = 9 Then
  423.   suono.FileName = App.Path & "\0_vexp.wav"
  424.   MsgBox "Nessuno ha fatto tris!!", , "info"
  425.    croce = False
  426.   lblx.Visible = False
  427.   lblo.Visible = True
  428.   For i = 0 To 8
  429.   lblm(i).Caption = ""
  430.   Next i
  431.   cont = 0
  432.   End If
  433. End Sub
  434.  
  435. Private Sub mnucanc_Click()
  436. suono.FileName = App.Path & "\bonus.wav"
  437.            For i = 0 To 8
  438.               lblm(i).Caption = ""
  439.            Next i
  440.  croce = False
  441.  lblo.Visible = True
  442.  lblx.Visible = False
  443.  cont = 0
  444. End Sub
  445.  
  446. Private Sub mnuesci_Click()
  447.  Dim ris As Integer
  448.  ris = MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "Esci")
  449.           If ris = vbYes Then
  450.              MsgBox "BY ALBERT KING!!!", vbExclamation, "CREATORE"
  451.              End
  452.           End If
  453. End Sub
  454.  
  455. Private Sub mnunome_Click()
  456.  nome1 = InputBox("Giocatore 1 (Scrivi il tuo nome)", "Giocatore 1")
  457.        If nome1 <> "" Then
  458.           Label1.Caption = nome1 & "  " & "x"
  459.        End If
  460.  nome2 = InputBox("Giocatore 2 (Scrivi il tuo nome)", "Giocatore 2")
  461.        If nome2 <> "" Then
  462.           label2.Caption = nome2 & "  " & "x"
  463.        End If
  464. End Sub