home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / format1r / frmsmfti.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-07-15  |  20.1 KB  |  607 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSMFTicTacToe 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "                          SMF Tic-Tac-Toe"
  6.    ClientHeight    =   4455
  7.    ClientLeft      =   2730
  8.    ClientTop       =   2040
  9.    ClientWidth     =   6675
  10.    Icon            =   "FrmSMFTicTacToe.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    MousePointer    =   15  'Size All
  15.    ScaleHeight     =   4455
  16.    ScaleWidth      =   6675
  17.    Begin VB.TextBox box9 
  18.       BackColor       =   &H00000000&
  19.       BeginProperty Font 
  20.          Name            =   "MS Sans Serif"
  21.          Size            =   24
  22.          Charset         =   0
  23.          Weight          =   400
  24.          Underline       =   0   'False
  25.          Italic          =   0   'False
  26.          Strikethrough   =   0   'False
  27.       EndProperty
  28.       ForeColor       =   &H000000FF&
  29.       Height          =   735
  30.       Left            =   3120
  31.       Locked          =   -1  'True
  32.       TabIndex        =   15
  33.       Top             =   2760
  34.       Width           =   495
  35.    End
  36.    Begin VB.TextBox box8 
  37.       BackColor       =   &H00000000&
  38.       BeginProperty Font 
  39.          Name            =   "MS Sans Serif"
  40.          Size            =   24
  41.          Charset         =   0
  42.          Weight          =   400
  43.          Underline       =   0   'False
  44.          Italic          =   0   'False
  45.          Strikethrough   =   0   'False
  46.       EndProperty
  47.       ForeColor       =   &H000000FF&
  48.       Height          =   735
  49.       Left            =   1920
  50.       Locked          =   -1  'True
  51.       TabIndex        =   14
  52.       Top             =   2760
  53.       Width           =   495
  54.    End
  55.    Begin VB.TextBox box7 
  56.       BackColor       =   &H00000000&
  57.       BeginProperty Font 
  58.          Name            =   "MS Sans Serif"
  59.          Size            =   24
  60.          Charset         =   0
  61.          Weight          =   400
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       ForeColor       =   &H000000FF&
  67.       Height          =   735
  68.       Left            =   600
  69.       Locked          =   -1  'True
  70.       TabIndex        =   13
  71.       Top             =   2760
  72.       Width           =   495
  73.    End
  74.    Begin VB.TextBox box6 
  75.       BackColor       =   &H00000000&
  76.       BeginProperty Font 
  77.          Name            =   "MS Sans Serif"
  78.          Size            =   24
  79.          Charset         =   0
  80.          Weight          =   400
  81.          Underline       =   0   'False
  82.          Italic          =   0   'False
  83.          Strikethrough   =   0   'False
  84.       EndProperty
  85.       ForeColor       =   &H000000FF&
  86.       Height          =   735
  87.       Left            =   3120
  88.       Locked          =   -1  'True
  89.       TabIndex        =   12
  90.       Top             =   1560
  91.       Width           =   495
  92.    End
  93.    Begin VB.TextBox box5 
  94.       BackColor       =   &H00000000&
  95.       BeginProperty Font 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   24
  98.          Charset         =   0
  99.          Weight          =   400
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       ForeColor       =   &H000000FF&
  105.       Height          =   735
  106.       Left            =   1920
  107.       Locked          =   -1  'True
  108.       TabIndex        =   11
  109.       Top             =   1560
  110.       Width           =   495
  111.    End
  112.    Begin VB.TextBox box4 
  113.       BackColor       =   &H00000000&
  114.       BeginProperty Font 
  115.          Name            =   "MS Sans Serif"
  116.          Size            =   24
  117.          Charset         =   0
  118.          Weight          =   400
  119.          Underline       =   0   'False
  120.          Italic          =   0   'False
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       ForeColor       =   &H000000FF&
  124.       Height          =   735
  125.       Left            =   600
  126.       Locked          =   -1  'True
  127.       TabIndex        =   10
  128.       Top             =   1560
  129.       Width           =   495
  130.    End
  131.    Begin VB.TextBox box3 
  132.       BackColor       =   &H00000000&
  133.       BeginProperty Font 
  134.          Name            =   "MS Sans Serif"
  135.          Size            =   24
  136.          Charset         =   0
  137.          Weight          =   400
  138.          Underline       =   0   'False
  139.          Italic          =   0   'False
  140.          Strikethrough   =   0   'False
  141.       EndProperty
  142.       ForeColor       =   &H000000FF&
  143.       Height          =   735
  144.       Left            =   3120
  145.       Locked          =   -1  'True
  146.       TabIndex        =   9
  147.       Top             =   360
  148.       Width           =   495
  149.    End
  150.    Begin VB.TextBox box2 
  151.       BackColor       =   &H00000000&
  152.       BeginProperty Font 
  153.          Name            =   "MS Sans Serif"
  154.          Size            =   24
  155.          Charset         =   0
  156.          Weight          =   400
  157.          Underline       =   0   'False
  158.          Italic          =   0   'False
  159.          Strikethrough   =   0   'False
  160.       EndProperty
  161.       ForeColor       =   &H000000FF&
  162.       Height          =   735
  163.       Left            =   1920
  164.       Locked          =   -1  'True
  165.       TabIndex        =   8
  166.       Top             =   360
  167.       Width           =   495
  168.    End
  169.    Begin VB.TextBox Box1 
  170.       BackColor       =   &H00000000&
  171.       BeginProperty Font 
  172.          Name            =   "MS Sans Serif"
  173.          Size            =   24
  174.          Charset         =   0
  175.          Weight          =   400
  176.          Underline       =   0   'False
  177.          Italic          =   0   'False
  178.          Strikethrough   =   0   'False
  179.       EndProperty
  180.       ForeColor       =   &H000000FF&
  181.       Height          =   735
  182.       Left            =   600
  183.       Locked          =   -1  'True
  184.       TabIndex        =   7
  185.       Top             =   360
  186.       Width           =   495
  187.    End
  188.    Begin VB.CommandButton Command1 
  189.       Caption         =   "EXIT"
  190.       Height          =   375
  191.       Left            =   2640
  192.       TabIndex        =   2
  193.       Top             =   3720
  194.       Width           =   855
  195.    End
  196.    Begin VB.CommandButton cmdPlayAgain 
  197.       Caption         =   "Play Again"
  198.       Height          =   375
  199.       Left            =   720
  200.       TabIndex        =   0
  201.       Top             =   3720
  202.       Width           =   1575
  203.    End
  204.    Begin VB.Timer Timer1 
  205.       Interval        =   1
  206.       Left            =   0
  207.       Top             =   3120
  208.    End
  209.    Begin VB.Label lblPlayer2points 
  210.       BackColor       =   &H00000000&
  211.       BeginProperty Font 
  212.          Name            =   "MS Sans Serif"
  213.          Size            =   24
  214.          Charset         =   0
  215.          Weight          =   400
  216.          Underline       =   0   'False
  217.          Italic          =   0   'False
  218.          Strikethrough   =   0   'False
  219.       EndProperty
  220.       ForeColor       =   &H000000FF&
  221.       Height          =   615
  222.       Left            =   4920
  223.       TabIndex        =   6
  224.       Top             =   2880
  225.       Width           =   735
  226.    End
  227.    Begin VB.Label lblPlayer1points 
  228.       BackColor       =   &H00000000&
  229.       BeginProperty Font 
  230.          Name            =   "MS Sans Serif"
  231.          Size            =   24
  232.          Charset         =   0
  233.          Weight          =   400
  234.          Underline       =   0   'False
  235.          Italic          =   0   'False
  236.          Strikethrough   =   0   'False
  237.       EndProperty
  238.       ForeColor       =   &H000000FF&
  239.       Height          =   615
  240.       Left            =   4920
  241.       TabIndex        =   5
  242.       Top             =   1440
  243.       Width           =   735
  244.    End
  245.    Begin VB.Label Label3 
  246.       BackColor       =   &H00000000&
  247.       Caption         =   "Player 2"
  248.       BeginProperty Font 
  249.          Name            =   "MS Sans Serif"
  250.          Size            =   24
  251.          Charset         =   0
  252.          Weight          =   400
  253.          Underline       =   0   'False
  254.          Italic          =   0   'False
  255.          Strikethrough   =   0   'False
  256.       EndProperty
  257.       ForeColor       =   &H000000FF&
  258.       Height          =   615
  259.       Left            =   4440
  260.       TabIndex        =   4
  261.       Top             =   2160
  262.       Width           =   1815
  263.    End
  264.    Begin VB.Label Label2 
  265.       BackColor       =   &H00000000&
  266.       Caption         =   "Player 1"
  267.       BeginProperty Font 
  268.          Name            =   "MS Sans Serif"
  269.          Size            =   24
  270.          Charset         =   0
  271.          Weight          =   400
  272.          Underline       =   0   'False
  273.          Italic          =   0   'False
  274.          Strikethrough   =   0   'False
  275.       EndProperty
  276.       ForeColor       =   &H000000FF&
  277.       Height          =   495
  278.       Left            =   4440
  279.       TabIndex        =   3
  280.       Top             =   720
  281.       Width           =   1815
  282.    End
  283.    Begin VB.Label Label1 
  284.       BackColor       =   &H00000000&
  285.       Caption         =   "TIE"
  286.       BeginProperty Font 
  287.          Name            =   "MS Sans Serif"
  288.          Size            =   24
  289.          Charset         =   0
  290.          Weight          =   400
  291.          Underline       =   0   'False
  292.          Italic          =   0   'False
  293.          Strikethrough   =   0   'False
  294.       EndProperty
  295.       ForeColor       =   &H000000FF&
  296.       Height          =   495
  297.       Left            =   1800
  298.       TabIndex        =   1
  299.       Top             =   1680
  300.       Visible         =   0   'False
  301.       Width           =   855
  302.    End
  303.    Begin VB.Line Line4 
  304.       BorderColor     =   &H000000FF&
  305.       BorderWidth     =   5
  306.       X1              =   240
  307.       X2              =   3960
  308.       Y1              =   2520
  309.       Y2              =   2520
  310.    End
  311.    Begin VB.Line Line3 
  312.       BorderColor     =   &H000000FF&
  313.       BorderWidth     =   5
  314.       X1              =   240
  315.       X2              =   3960
  316.       Y1              =   1320
  317.       Y2              =   1320
  318.    End
  319.    Begin VB.Line Line2 
  320.       BorderColor     =   &H000000FF&
  321.       BorderWidth     =   5
  322.       X1              =   2760
  323.       X2              =   2760
  324.       Y1              =   360
  325.       Y2              =   3480
  326.    End
  327.    Begin VB.Line Line1 
  328.       BorderColor     =   &H000000FF&
  329.       BorderWidth     =   5
  330.       X1              =   1560
  331.       X2              =   1560
  332.       Y1              =   360
  333.       Y2              =   3480
  334.    End
  335. Attribute VB_Name = "frmSMFTicTacToe"
  336. Attribute VB_GlobalNameSpace = False
  337. Attribute VB_Creatable = False
  338. Attribute VB_PredeclaredId = True
  339. Attribute VB_Exposed = False
  340. Option Explicit
  341. Dim player1points As Integer
  342. Dim player2points As Integer
  343. Private Sub Box1_click()
  344. If Box1.Text = "" And MousePointer = 15 Then
  345.     Box1.Text = "X"
  346.     MousePointer = 12
  347. End If
  348. If Box1.Text = "" And MousePointer = 12 Then
  349.     Box1.Text = "O"
  350.     MousePointer = 15
  351.     End If
  352. End Sub
  353. Private Sub Box2_Click()
  354. If box2.Text = "" And MousePointer = 15 Then
  355.     box2.Text = "X"
  356.     MousePointer = 12
  357. End If
  358. If box2.Text = "" And MousePointer = 12 Then
  359.     box2.Text = "O"
  360.     MousePointer = 15
  361.     End If
  362. End Sub
  363. Private Sub Box3_Click()
  364. If box3.Text = "" And MousePointer = 15 Then
  365.     box3.Text = "X"
  366.     MousePointer = 12
  367. End If
  368. If box3.Text = "" And MousePointer = 12 Then
  369.     box3.Text = "O"
  370.     MousePointer = 15
  371.     End If
  372. End Sub
  373. Private Sub box4_Click()
  374. If box4.Text = "" And MousePointer = 15 Then
  375.     box4.Text = "X"
  376.     MousePointer = 12
  377. End If
  378. If box4.Text = "" And MousePointer = 12 Then
  379.     box4.Text = "O"
  380.     MousePointer = 15
  381.     End If
  382. End Sub
  383. Private Sub Box5_Click()
  384. If box5.Text = "" And MousePointer = 15 Then
  385.     box5.Text = "X"
  386.     MousePointer = 12
  387. End If
  388. If box5.Text = "" And MousePointer = 12 Then
  389.     box5.Text = "O"
  390.     MousePointer = 15
  391.     End If
  392. End Sub
  393. Private Sub box6_Click()
  394. If box6.Text = "" And MousePointer = 15 Then
  395.     box6.Text = "X"
  396.     MousePointer = 12
  397. End If
  398. If box6.Text = "" And MousePointer = 12 Then
  399.     box6.Text = "O"
  400.     MousePointer = 15
  401.     End If
  402. End Sub
  403. Private Sub Box7_Click()
  404. If box7.Text = "" And MousePointer = 15 Then
  405.     box7.Text = "X"
  406.     MousePointer = 12
  407. End If
  408. If box7.Text = "" And MousePointer = 12 Then
  409.     box7.Text = "O"
  410.     MousePointer = 15
  411.     End If
  412. End Sub
  413. Private Sub Box8_Click()
  414. If box8.Text = "" And MousePointer = 15 Then
  415.     box8.Text = "X"
  416.     MousePointer = 12
  417. End If
  418. If box8.Text = "" And MousePointer = 12 Then
  419.     box8.Text = "O"
  420.     MousePointer = 15
  421.     End If
  422. End Sub
  423. Private Sub Box9_Click()
  424. If box9.Text = "" And MousePointer = 15 Then
  425.     box9.Text = "X"
  426.     MousePointer = 12
  427. End If
  428. If box9.Text = "" And MousePointer = 12 Then
  429.     box9.Text = "O"
  430.     MousePointer = 15
  431.     End If
  432. End Sub
  433. Private Sub Command1_Click()
  434. End Sub
  435. Private Sub cmdPlayAgain_Click()
  436. Timer1.Interval = 1
  437.     Box1.Visible = True
  438.     box2.Visible = True
  439.     box3.Visible = True
  440.     box4.Visible = True
  441.     box5.Visible = True
  442.     box6.Visible = True
  443.     box7.Visible = True
  444.     box8.Visible = True
  445.     box9.Visible = True
  446.     Line1.Visible = True
  447.     Line2.Visible = True
  448.     Line3.Visible = True
  449.     Line4.Visible = True
  450.     Label1.Visible = False
  451.     Box1.Text = ""
  452.     box2.Text = ""
  453.     box3.Text = ""
  454.     box4.Text = ""
  455.     box5.Text = ""
  456.     box6.Text = ""
  457.     box7.Text = ""
  458.     box8.Text = ""
  459.     box9.Text = ""
  460. End Sub
  461. Private Sub Timer1_Timer()
  462. '***************************** X's ***********************************
  463. If Box1.Text = "X" And box2.Text = "X" And box3.Text = "X" Then
  464.     box4.Visible = False: box5.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  465.     player1points = player1points + 1
  466.     lblPlayer1points.Caption = player1points
  467.     Timer1.Interval = 0
  468.     Exit Sub
  469. End If
  470. If box4.Text = "X" And box5.Text = "X" And box6.Text = "X" Then
  471.     Box1.Visible = False: box2.Visible = False: box3.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  472.     player1points = player1points + 1
  473.     lblPlayer1points.Caption = player1points
  474.     Timer1.Interval = 0
  475.     Exit Sub
  476. End If
  477. If box7.Text = "X" And box8.Text = "X" And box9.Text = "X" Then
  478.     Box1.Visible = False: box2.Visible = False: box3.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False:
  479.     player1points = player1points + 1
  480.     lblPlayer1points.Caption = player1points
  481.     Timer1.Interval = 0
  482.     Exit Sub
  483. End If
  484. If Box1.Text = "X" And box5.Text = "X" And box9.Text = "X" Then
  485.     box2.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False:
  486.     player1points = player1points + 1
  487.     lblPlayer1points.Caption = player1points
  488.     Timer1.Interval = 0
  489.     Exit Sub
  490. End If
  491. If box3.Text = "X" And box5.Text = "X" And box7.Text = "X" Then
  492.     Box1.Visible = False: box4.Visible = False: box8.Visible = False: box9.Visible = False: box2.Visible = False: box6.Visible = False:
  493.     player1points = player1points + 1
  494.     lblPlayer1points.Caption = player1points
  495.     Timer1.Interval = 0
  496.     Exit Sub
  497. End If
  498. If Box1.Text = "X" And box4.Text = "X" And box7.Text = "X" Then
  499.     box2.Visible = False: box3.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False: box9.Visible = False:
  500.     player1points = player1points + 1
  501.     lblPlayer1points.Caption = player1points
  502.     Timer1.Interval = 0
  503.     Exit Sub
  504. End If
  505. If box2.Text = "X" And box5.Text = "X" And box8.Text = "X" Then
  506.     Box1.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box9.Visible = False:
  507.     player1points = player1points + 1
  508.     lblPlayer1points.Caption = player1points
  509.     Timer1.Interval = 0
  510.     Exit Sub
  511. End If
  512. If box3.Text = "X" And box6.Text = "X" And box9.Text = "X" Then
  513.     Box1.Visible = False: box4.Visible = False: box7.Visible = False: box2.Visible = False: box5.Visible = False: box8.Visible = False:
  514.     player1points = player1points + 1
  515.     lblPlayer1points.Caption = player1points
  516.     Timer1.Interval = 0
  517.     Exit Sub
  518. End If
  519. If Box1.Text = "X" And box3.Text = "X" And box7.Text = "X" And box9.Text = "X" Then
  520.     box2.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False
  521.     player1points = player1points + 1
  522.     lblPlayer1points.Caption = player1points
  523.     Timer1.Interval = 0
  524.     Exit Sub
  525. End If
  526. '***************************** O's ***********************************
  527. If Box1.Text = "O" And box2.Text = "O" And box3.Text = "O" Then
  528.     box4.Visible = False: box5.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  529.     player2points = player2points + 1
  530.     lblPlayer2points.Caption = player2points
  531.     Timer1.Interval = 0
  532.     Exit Sub
  533. End If
  534. If box4.Text = "O" And box5.Text = "O" And box6.Text = "O" Then
  535.     Box1.Visible = False: box2.Visible = False: box3.Visible = False: box7.Visible = False: box8.Visible = False: box9.Visible = False:
  536.     player2points = player2points + 1
  537.     lblPlayer2points.Caption = player2points
  538.     Timer1.Interval = 0
  539.     Exit Sub
  540. End If
  541. If box7.Text = "O" And box8.Text = "O" And box9.Text = "O" Then
  542.     Box1.Visible = False: box2.Visible = False: box3.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False:
  543.     player2points = player2points + 1
  544.     lblPlayer2points.Caption = player2points
  545.     Timer1.Interval = 0
  546.     Exit Sub
  547. End If
  548. If Box1.Text = "O" And box5.Text = "O" And box9.Text = "O" Then
  549.     box2.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box8.Visible = False:
  550.     player2points = player2points + 1
  551.     lblPlayer2points.Caption = player2points
  552.     Timer1.Interval = 0
  553.     Exit Sub
  554. End If
  555. If box3.Text = "O" And box5.Text = "O" And box7.Text = "O" Then
  556.     Box1.Visible = False: box4.Visible = False: box8.Visible = False: box9.Visible = False: box2.Visible = False: box6.Visible = False:
  557.     player2points = player2points + 1
  558.     lblPlayer2points.Caption = player2points
  559.     Timer1.Interval = 0
  560.     Exit Sub
  561. End If
  562. If Box1.Text = "O" And box4.Text = "O" And box7.Text = "O" Then
  563.     box2.Visible = False: box3.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False: box9.Visible = False:
  564.     player2points = player2points + 1
  565.     lblPlayer2points.Caption = player2points
  566.     Timer1.Interval = 0
  567.     Exit Sub
  568. End If
  569. If box2.Text = "O" And box5.Text = "O" And box8.Text = "O" Then
  570.     Box1.Visible = False: box3.Visible = False: box4.Visible = False: box6.Visible = False: box7.Visible = False: box9.Visible = False:
  571.     player2points = player2points + 1
  572.     lblPlayer2points.Caption = player2points
  573.     Timer1.Interval = 0
  574.     Exit Sub
  575. End If
  576. If box3.Text = "O" And box6.Text = "O" And box9.Text = "O" Then
  577.     Box1.Visible = False: box4.Visible = False: box7.Visible = False: box2.Visible = False: box5.Visible = False: box8.Visible = False:
  578.     player2points = player2points + 1
  579.     lblPlayer2points.Caption = player2points
  580.     Timer1.Interval = 0
  581.     Exit Sub
  582. End If
  583. If Box1.Text = "O" And box3.Text = "O" And box7.Text = "O" And box9.Text = "O" Then
  584.     box2.Visible = False: box4.Visible = False: box5.Visible = False: box6.Visible = False: box8.Visible = False
  585.     player2points = player2points + 1
  586.     lblPlayer2points.Caption = player2points
  587.     Timer1.Interval = 0
  588.     Exit Sub
  589. End If
  590. If Box1.Text <> "" And box2.Text <> "" And box3.Text <> "" And box4.Text <> "" And box5.Text <> "" And box6.Text <> "" And box7.Text <> "" And box8.Text <> "" And box9.Text <> "" Then
  591.     Box1.Visible = False
  592.     box2.Visible = False
  593.     box3.Visible = False
  594.     box4.Visible = False
  595.     box5.Visible = False
  596.     box6.Visible = False
  597.     box7.Visible = False
  598.     box8.Visible = False
  599.     box9.Visible = False
  600.     Line1.Visible = False
  601.     Line2.Visible = False
  602.     Line3.Visible = False
  603.     Line4.Visible = False
  604.     Label1.Visible = True
  605. End If
  606. End Sub
  607.