Form1.frm
资源名称:七八个vb游戏.rar [点击查看]
上传用户:tashmp
上传日期:2010-04-03
资源大小:882k
文件大小:13k
源码类别:
其他游戏
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "三子棋"
- ClientHeight = 3000
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6060
- Icon = "Form1.frx":0000
- LinkTopic = "Form1"
- ScaleHeight = 3000
- ScaleWidth = 6060
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command3
- Caption = "退出"
- Height = 495
- Left = 4680
- TabIndex = 12
- Top = 2400
- Width = 1335
- End
- Begin VB.CommandButton Command2
- Caption = "开始"
- Height = 495
- Left = 2880
- TabIndex = 10
- Top = 2400
- Width = 1575
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 8
- Left = 2040
- TabIndex = 8
- Top = 2040
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 7
- Left = 1080
- TabIndex = 7
- Top = 2040
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 6
- Left = 120
- TabIndex = 6
- Top = 2040
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 5
- Left = 2040
- TabIndex = 5
- Top = 1080
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 4
- Left = 1080
- TabIndex = 4
- Top = 1080
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 3
- Left = 120
- TabIndex = 3
- Top = 1080
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 2
- Left = 2040
- TabIndex = 2
- Top = 120
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 1
- Left = 1080
- TabIndex = 1
- Top = 120
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 735
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 735
- End
- Begin VB.Image Image2
- Height = 480
- Left = 5520
- Picture = "Form1.frx":08CA
- Top = 960
- Width = 480
- End
- Begin VB.Label Label6
- Caption = "0"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 4560
- TabIndex = 16
- Top = 1080
- Width = 615
- End
- Begin VB.Label Label5
- Caption = "O方胜利次数"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 2880
- TabIndex = 15
- Top = 1080
- Width = 1575
- End
- Begin VB.Image Image1
- Height = 480
- Left = 5520
- Picture = "Form1.frx":1194
- Top = 0
- Width = 480
- End
- Begin VB.Label Label4
- Caption = "0"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 495
- Left = 4440
- TabIndex = 14
- Top = 120
- Width = 855
- End
- Begin VB.Label Label3
- Caption = "X方胜利次数"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 2880
- TabIndex = 13
- Top = 120
- Width = 1455
- End
- Begin VB.Label Label2
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 18
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 495
- Left = 4200
- TabIndex = 11
- Top = 1800
- Width = 1695
- End
- Begin VB.Label Label1
- Caption = "胜者:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 3000
- TabIndex = 9
- Top = 1800
- Width = 975
- End
- Begin VB.Line Line4
- X1 = 1920
- X2 = 1920
- Y1 = 120
- Y2 = 2760
- End
- Begin VB.Line Line3
- X1 = 120
- X2 = 2760
- Y1 = 1920
- Y2 = 1920
- End
- Begin VB.Line Line2
- X1 = 960
- X2 = 960
- Y1 = 120
- Y2 = 2760
- End
- Begin VB.Line Line1
- X1 = 120
- X2 = 2760
- Y1 = 960
- Y2 = 960
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim Times_number As Integer
- Dim win_X As Integer
- Dim win_O As Integer
- Dim winer As Boolean
- Private Sub Command1_Click(Index As Integer)
- '下棋的次数
- Times_number = Times_number + 1
- Command1(Index).Enabled = False
- If Times_number Mod 2 <> 0 Then
- Command1(Index).Caption = "X"
- Else
- Command1(Index).Caption = "O"
- End If
- '<1> 0-1-2
- If (Command1(0).Caption = Command1(1).Caption) And _
- (Command1(1).Caption = Command1(2).Caption) And _
- (Command1(0).Caption <> "" And Command1(1).Caption <> "" And Command1(2).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- ' MsgBox "0-1-2"
- '<2> 0-4-8
- ElseIf (Command1(0).Caption = Command1(4).Caption) And _
- (Command1(4).Caption = Command1(8).Caption) And _
- (Command1(0).Caption <> "" And Command1(4).Caption <> "" And Command1(8).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- '************************
- ' MsgBox "0-4-8"
- '<3> 0-3-6
- ElseIf (Command1(0).Caption = Command1(3).Caption) And _
- (Command1(3).Caption = Command1(6).Caption) And _
- (Command1(0).Caption <> "" And Command1(3).Caption <> "" And Command1(6).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- ' MsgBox "0-3-6"
- '<4> 1-4-7
- ElseIf (Command1(1).Caption = Command1(4).Caption) And _
- (Command1(4).Caption = Command1(7).Caption) And _
- (Command1(1).Caption <> "" And Command1(4).Caption <> "" And Command1(7).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- '<>2-4-6
- ElseIf (Command1(2).Caption = Command1(4).Caption) And _
- (Command1(4).Caption = Command1(6).Caption) And _
- (Command1(2).Caption <> "" And Command1(4).Caption <> "" And Command1(6).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- ''''''''''''''''''''''''''''''''''''
- ' MsgBox "1-4-7"
- '<5> 2-5-8
- ElseIf (Command1(2).Caption = Command1(5).Caption) And _
- (Command1(5).Caption = Command1(8).Caption) And _
- (Command1(2).Caption <> "" And Command1(5).Caption <> "" And Command1(8).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- ' MsgBox "2-5-8"
- '<6> 3-4-5
- ElseIf (Command1(3).Caption = Command1(4).Caption) And _
- (Command1(4).Caption = Command1(5).Caption) And _
- (Command1(3).Caption <> "" And Command1(4).Caption <> "" And Command1(5).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- ' MsgBox "3-4-5"
- '<7> 6-7-8
- ElseIf (Command1(6).Caption = Command1(7).Caption) And _
- (Command1(7).Caption = Command1(8).Caption) And _
- (Command1(6).Caption <> "" And Command1(7).Caption <> "" And Command1(8).Caption <> "") Then
- Label2.Caption = "为:" + Command1(Index).Caption
- Command2.Enabled = True
- '**************************
- If Command1(Index).Caption = "X" Then
- win_X = win_X + 1
- Label4.Caption = Str(win_X)
- Else
- win_O = win_O + 1
- Label6.Caption = Str(win_O)
- End If
- winer = True
- '************************
- ' MsgBox "6-7-8"
- End If
- If Times_number = 9 And winer <> True Then
- Label2.Caption = "双方平局"
- Command2.Enabled = True
- End If
- End Sub
- '开始
- Private Sub Command2_Click()
- Dim i As Integer
- For i = 0 To 8 Step 1
- Command1(i).Caption = ""
- Command1(i).Enabled = True
- Next i
- Command2.Enabled = False
- Label2.Caption = ""
- winer = False
- Times_number = 0
- End Sub
- Private Sub Command3_Click()
- End
- End Sub
- Private Sub Form_Load()
- Dim i As Integer
- For i = 0 To 8 Step 1
- Command1(i).Enabled = False
- Command1(i).Caption = ""
- Command1(i).FontSize = 25
- Next i
- Times_nmumber = 0
- win_X = 0
- win_O = 0
- 'winer 判断是否有一方胜利
- winer = fase
- Show
- Form1.Left = (Screen.Width - Form1.Width) / 2
- Form1.Top = (Screen.Height - Form1.Height) / 2 - 1300
- End Sub