home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / tic-ta1a / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-10-11  |  7.1 KB  |  222 lines

  1. VERSION 5.00
  2. Begin VB.Form Main 
  3.    BorderStyle     =   0  'None
  4.    Caption         =   "Tic-Tac-Toe v0.X"
  5.    ClientHeight    =   3000
  6.    ClientLeft      =   0
  7.    ClientTop       =   0
  8.    ClientWidth     =   3000
  9.    Icon            =   "Form1.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    Picture         =   "Form1.frx":014A
  12.    ScaleHeight     =   3000
  13.    ScaleWidth      =   3000
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.Label YPoints 
  16.       BackStyle       =   0  'Transparent
  17.       Caption         =   "=0"
  18.       Height          =   240
  19.       Left            =   630
  20.       TabIndex        =   4
  21.       Top             =   2655
  22.       Width           =   300
  23.    End
  24.    Begin VB.Label XPoints 
  25.       BackStyle       =   0  'Transparent
  26.       Caption         =   "=0"
  27.       Height          =   255
  28.       Left            =   285
  29.       TabIndex        =   3
  30.       Top             =   2460
  31.       Width           =   240
  32.    End
  33.    Begin VB.Label About_Label 
  34.       BackStyle       =   0  'Transparent
  35.       Height          =   240
  36.       Left            =   2400
  37.       TabIndex        =   2
  38.       Top             =   90
  39.       Width           =   240
  40.    End
  41.    Begin VB.Image ImageX 
  42.       Height          =   390
  43.       Left            =   2490
  44.       Picture         =   "Form1.frx":1EB4
  45.       Top             =   2640
  46.       Width           =   375
  47.    End
  48.    Begin VB.Image image0 
  49.       Height          =   390
  50.       Left            =   1995
  51.       Picture         =   "Form1.frx":21A7
  52.       Top             =   2655
  53.       Width           =   375
  54.    End
  55.    Begin VB.Image Spot 
  56.       Height          =   390
  57.       Index           =   8
  58.       Left            =   2055
  59.       Picture         =   "Form1.frx":24A0
  60.       Top             =   2010
  61.       Width           =   375
  62.    End
  63.    Begin VB.Image Spot 
  64.       Height          =   390
  65.       Index           =   7
  66.       Left            =   1290
  67.       Picture         =   "Form1.frx":2799
  68.       Top             =   2040
  69.       Width           =   375
  70.    End
  71.    Begin VB.Image Spot 
  72.       Height          =   390
  73.       Index           =   6
  74.       Left            =   630
  75.       Picture         =   "Form1.frx":2A92
  76.       Top             =   2040
  77.       Width           =   375
  78.    End
  79.    Begin VB.Image Spot 
  80.       Height          =   390
  81.       Index           =   5
  82.       Left            =   1950
  83.       Picture         =   "Form1.frx":2D8B
  84.       Top             =   1380
  85.       Width           =   375
  86.    End
  87.    Begin VB.Image Spot 
  88.       Height          =   390
  89.       Index           =   4
  90.       Left            =   1245
  91.       Picture         =   "Form1.frx":3084
  92.       Top             =   1395
  93.       Width           =   375
  94.    End
  95.    Begin VB.Image Spot 
  96.       Height          =   390
  97.       Index           =   3
  98.       Left            =   600
  99.       Picture         =   "Form1.frx":337D
  100.       Top             =   1440
  101.       Width           =   375
  102.    End
  103.    Begin VB.Image Spot 
  104.       Height          =   390
  105.       Index           =   2
  106.       Left            =   1815
  107.       Picture         =   "Form1.frx":3676
  108.       Top             =   750
  109.       Width           =   375
  110.    End
  111.    Begin VB.Image Spot 
  112.       Height          =   390
  113.       Index           =   1
  114.       Left            =   1170
  115.       Picture         =   "Form1.frx":396F
  116.       Top             =   810
  117.       Width           =   375
  118.    End
  119.    Begin VB.Image Spot 
  120.       Height          =   390
  121.       Index           =   0
  122.       Left            =   555
  123.       Picture         =   "Form1.frx":3C68
  124.       Top             =   825
  125.       Width           =   375
  126.    End
  127.    Begin VB.Label Minimize_Label 
  128.       BackStyle       =   0  'Transparent
  129.       Height          =   240
  130.       Left            =   2100
  131.       TabIndex        =   1
  132.       Top             =   90
  133.       Width           =   240
  134.    End
  135.    Begin VB.Label Exit_Label 
  136.       BackStyle       =   0  'Transparent
  137.       Height          =   240
  138.       Left            =   2670
  139.       TabIndex        =   0
  140.       Top             =   75
  141.       Width           =   240
  142.    End
  143. Attribute VB_Name = "Main"
  144. Attribute VB_GlobalNameSpace = False
  145. Attribute VB_Creatable = False
  146. Attribute VB_PredeclaredId = True
  147. Attribute VB_Exposed = False
  148. Option Explicit
  149. Dim Turn As Byte 'player turn 1=O 5=X
  150. Private Sub About_Label_Click()
  151.     MsgBox "TIC-TAC-TOE" + vbCrLf + "Simple Code" + vbCrLf + "For anyone to use and abuse" + vbCrLf + vbCrLf + "Jos
  152.  Machado" + vbCrLf + "a.k.a. MacMadMan" + vbCrLf + "Contact me: jose.machado@virtualazores.com" + vbCrLf + vbCrLf + ":) ENJOY (:"
  153. End Sub
  154. Private Sub Exit_Label_Click()
  155.     Unload Me
  156.     Unload WinnerMessage
  157. End Sub
  158. Private Sub clear_spots()
  159.     Dim i As Integer
  160.     For i = 0 To 8
  161.         Set Spot(i).Picture = Nothing
  162.         Spot(i).Tag = 0
  163.     Next i
  164. End Sub
  165. Private Sub Form_Load()
  166.     image0.Visible = False
  167.     ImageX.Visible = False
  168.     Load WinnerMessage
  169.     clear_spots
  170. End Sub
  171. Private Sub Minimize_Label_Click()
  172.     Me.WindowState = vbMinimized
  173. End Sub
  174. Private Sub Spot_Click(Index As Integer)
  175.     If Turn = 1 Then
  176.         If Spot(Index).Tag = 0 Then
  177.             Spot(Index).Tag = 1
  178.             Spot(Index).Picture = image0.Picture
  179.             Turn = 2
  180.             checkwinner
  181.         End If
  182.     Else
  183.         If Spot(Index).Tag = 0 Then
  184.             Spot(Index).Tag = 5
  185.             Spot(Index).Picture = ImageX.Picture
  186.             Turn = 1
  187.             checkwinner
  188.         End If
  189.     End If
  190. End Sub
  191. Private Sub checkwinner()
  192.     With Spot
  193.         If (.Item(0).Tag = 5 And .Item(1).Tag = 5 And .Item(2).Tag = 5) Or _
  194.            (.Item(3).Tag = 5 And .Item(4).Tag = 5 And .Item(5).Tag = 5) Or _
  195.            (.Item(6).Tag = 5 And .Item(7).Tag = 5 And .Item(8).Tag = 5) Or _
  196.            (.Item(0).Tag = 5 And .Item(3).Tag = 5 And .Item(6).Tag = 5) Or _
  197.            (.Item(1).Tag = 5 And .Item(4).Tag = 5 And .Item(7).Tag = 5) Or _
  198.            (.Item(2).Tag = 5 And .Item(5).Tag = 5 And .Item(8).Tag = 5) Or _
  199.            (.Item(0).Tag = 5 And .Item(4).Tag = 5 And .Item(8).Tag = 5) Or _
  200.            (.Item(2).Tag = 5 And .Item(4).Tag = 5 And .Item(6).Tag = 5) Then
  201.            WinnerMessage.Label2 = "One more to 'X'"
  202.            WinnerMessage.Show 1
  203.            XPoints = "=" & Val(Mid(XPoints, 2)) + 1
  204.            clear_spots
  205.         Else
  206.         If (.Item(0).Tag = 1 And .Item(1).Tag = 1 And .Item(2).Tag = 1) Or _
  207.            (.Item(3).Tag = 1 And .Item(4).Tag = 1 And .Item(5).Tag = 1) Or _
  208.            (.Item(6).Tag = 1 And .Item(7).Tag = 1 And .Item(8).Tag = 1) Or _
  209.            (.Item(0).Tag = 1 And .Item(3).Tag = 1 And .Item(6).Tag = 1) Or _
  210.            (.Item(1).Tag = 1 And .Item(4).Tag = 1 And .Item(7).Tag = 1) Or _
  211.            (.Item(2).Tag = 1 And .Item(5).Tag = 1 And .Item(8).Tag = 1) Or _
  212.            (.Item(0).Tag = 1 And .Item(4).Tag = 1 And .Item(8).Tag = 1) Or _
  213.            (.Item(2).Tag = 1 And .Item(4).Tag = 1 And .Item(6).Tag = 1) Then
  214.            WinnerMessage.Label2 = "One more to '0'"
  215.            WinnerMessage.Show 1
  216.            YPoints = "=" & Val(Mid(YPoints, 1)) + 1
  217.            clear_spots
  218.         End If
  219.         End If
  220.     End With
  221. End Sub
  222.