⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hrd.frm

📁 用vb编写的华容道游戏
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5715
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6765
   LinkTopic       =   "Form1"
   ScaleHeight     =   5715
   ScaleWidth      =   6765
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command9 
      Caption         =   "Command9"
      Height          =   855
      Left            =   4560
      TabIndex        =   22
      Top             =   2880
      Width           =   375
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "C:\WINDOWS\Profiles\ykck001\My Documents\华容道\data.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   4800
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   4920
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.CommandButton Command8 
      Appearance      =   0  'Flat
      Caption         =   "重新开始"
      Height          =   495
      Left            =   5160
      TabIndex        =   16
      Top             =   3240
      Width           =   1455
   End
   Begin VB.CommandButton Command7 
      Caption         =   "屯兵东路"
      Height          =   495
      Left            =   5160
      TabIndex        =   15
      Top             =   2400
      Width           =   1455
   End
   Begin VB.CommandButton Command6 
      Caption         =   "分兵三路"
      Height          =   495
      Left            =   5160
      TabIndex        =   14
      Top             =   1920
      Width           =   1455
   End
   Begin VB.CommandButton Command5 
      Caption         =   "横刀立马(二)"
      Height          =   495
      Left            =   5160
      TabIndex        =   13
      Top             =   960
      Width           =   1455
   End
   Begin VB.CommandButton Command4 
      Caption         =   "齐头并进"
      Height          =   495
      Left            =   5160
      TabIndex        =   12
      Top             =   1440
      Width           =   1455
   End
   Begin VB.CommandButton Command3 
      Caption         =   "横刀立马(一)"
      Height          =   495
      Left            =   5160
      TabIndex        =   11
      Top             =   480
      Width           =   1455
   End
   Begin VB.Frame Frame2 
      Height          =   3375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2655
      Begin VB.CommandButton Command2 
         Caption         =   "下"
         Height          =   250
         Index           =   7
         Left            =   240
         TabIndex        =   21
         Top             =   720
         Visible         =   0   'False
         Width           =   500
      End
      Begin VB.CommandButton Command2 
         Caption         =   "右"
         Height          =   500
         Index           =   5
         Left            =   720
         TabIndex        =   20
         Top             =   240
         Visible         =   0   'False
         Width           =   250
      End
      Begin VB.CommandButton Command2 
         Caption         =   "左"
         Height          =   500
         Index           =   3
         Left            =   0
         TabIndex        =   19
         Top             =   240
         Visible         =   0   'False
         Width           =   250
      End
      Begin VB.CommandButton Command2 
         Appearance      =   0  'Flat
         Caption         =   "上"
         Height          =   250
         Index           =   1
         Left            =   240
         TabIndex        =   18
         Top             =   0
         Visible         =   0   'False
         Width           =   500
      End
      Begin VB.CommandButton Command1 
         Height          =   1200
         Index           =   0
         Left            =   120
         Picture         =   "hrd.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   240
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Appearance      =   0  'Flat
         Height          =   1200
         Index           =   1
         Left            =   720
         Picture         =   "hrd.frx":7432
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   240
         Width           =   1200
      End
      Begin VB.CommandButton Command1 
         Height          =   1200
         Index           =   2
         Left            =   1920
         Picture         =   "hrd.frx":15A24
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   240
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Height          =   1200
         Index           =   3
         Left            =   120
         Picture         =   "hrd.frx":1CE56
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   1440
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Appearance      =   0  'Flat
         Height          =   600
         Index           =   4
         Left            =   720
         Picture         =   "hrd.frx":24288
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   1440
         Width           =   1200
      End
      Begin VB.CommandButton Command1 
         Height          =   1200
         Index           =   5
         Left            =   1920
         Picture         =   "hrd.frx":2B5A2
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   1440
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Height          =   600
         Index           =   6
         Left            =   120
         Picture         =   "hrd.frx":329D4
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   2640
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Height          =   600
         Index           =   7
         Left            =   720
         Picture         =   "hrd.frx":3640E
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   2040
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Height          =   600
         Index           =   8
         Left            =   1320
         Picture         =   "hrd.frx":39E48
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   2040
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Height          =   600
         Index           =   9
         Left            =   1920
         Picture         =   "hrd.frx":3D882
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   2640
         Width           =   600
      End
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5160
      TabIndex        =   17
      Top             =   3960
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(4, 3) As Integer
Dim b(9, 1) As Integer
Dim left_ok As Boolean
Dim right_ok As Boolean
Dim up_ok As Boolean
Dim down_ok As Boolean
Dim move_num As Integer
Dim step_num As Integer
Dim step1 As Integer

Private Sub Command1_Click(Index As Integer)
Dim ok_num As Integer
ok_num = 0
Command2(1).Visible = False
Command2(3).Visible = False
Command2(5).Visible = False
Command2(7).Visible = False


check_me (Index)

If left_ok Then
ok_num = ok_num + 1
End If
If down_ok Then
ok_num = ok_num + 1
End If
If right_ok Then
ok_num = ok_num + 1
End If
If up_ok Then
ok_num = ok_num + 1
End If
If ok_num = 1 Then
    If left_ok Then
    move_left (Index)
    End If
    If right_ok Then
    move_right (Index)
    End If
    If down_ok Then
    move_down (Index)
    End If
    If up_ok Then
    move_up (Index)
    End If
        left_ok = False
    right_ok = False
    down_ok = False
    up_ok = False

End If
If ok_num > 1 Then
    If left_ok Then
    Command2(3).Visible = True
    Command2(3).Left = Command1(Index).Left
    Command2(3).Top = Command1(Index).Height / 2 + Command1(Index).Top - Command2(3).Height / 2
    Else
    Command2(3).Visible = False
    
    End If
    If right_ok Then
    Command2(5).Visible = True
    Command2(5).Left = Command1(Index).Width - Command2(5).Width + Command1(Index).Left
    Command2(5).Top = Command1(Index).Height / 2 + Command1(Index).Top - Command2(5).Height / 2
    
    Else
    Command2(5).Visible = False
    
    End If
    If down_ok Then
    Command2(7).Visible = True
    Command2(7).Left = Command1(Index).Width / 2 - Command2(7).Width / 2 + Command1(Index).Left
    Command2(7).Top = Command1(Index).Height - Command2(7).Height + Command1(Index).Top
    
    Else
    Command2(7).Visible = False
    
    End If
    If up_ok Then
    Command2(1).Visible = True
    Command2(1).Left = Command1(Index).Width / 2 - Command2(1).Width / 2 + Command1(Index).Left
    Command2(1).Top = Command1(Index).Top
    
    Else
    Command2(1).Visible = False
    
    End If

move_num = Index

End If
    
    
    left_ok = False
    right_ok = False
    down_ok = False
    up_ok = False
    
End Sub

Private Sub Command2_Click(Index As Integer)
Select Case Index
Case 1
move_up (move_num)

Case 3
move_left (move_num)

Case 5
move_right (move_num)

Case 7
move_down (move_num)

End Select
    Command2(1).Visible = False
    Command2(3).Visible = False
    Command2(5).Visible = False
    Command2(7).Visible = False

End Sub

Private Sub Command2_LostFocus(Index As Integer)
    Command2(1).Visible = False
    Command2(3).Visible = False
    Command2(5).Visible = False
    Command2(7).Visible = False

End Sub

Private Sub Command3_Click()
Dim i, j As Integer
left_ok = False
right_ok = False
up_ok = False
down_ok = False
step_num = 1
For i = 0 To 4
 For j = 0 To 3
   a(i, j) = 1
 Next j
Next i
a(4, 1) = 0
a(4, 2) = 0

b(0, 0) = 0
b(0, 1) = 0
b(1, 0) = 0
b(1, 1) = 1
b(2, 0) = 0
b(2, 1) = 3
b(3, 0) = 2
b(3, 1) = 0
b(4, 0) = 2
b(4, 1) = 1
b(5, 0) = 2
b(5, 1) = 3
b(6, 0) = 4
b(6, 1) = 0
b(7, 0) = 3
b(7, 1) = 1
b(8, 0) = 3
b(8, 1) = 2
b(9, 0) = 4
b(9, 1) = 3
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 100
Command1(i).Top = b(i, 0) * 600 + 200
Next i
End Sub

Private Sub Command4_Click()
Dim i, j As Integer
left_ok = False
right_ok = False
up_ok = False
down_ok = False
step_num = 2


For i = 0 To 4
 For j = 0 To 3
   a(i, j) = 1
 Next j
Next i
a(4, 1) = 0
a(4, 2) = 0

b(0, 0) = 0
b(0, 1) = 3
b(1, 0) = 0
b(1, 1) = 1
b(2, 0) = 3
b(2, 1) = 3
b(3, 0) = 0
b(3, 1) = 0
b(4, 0) = 3
b(4, 1) = 1
b(5, 0) = 3
b(5, 1) = 0
b(6, 0) = 2
b(6, 1) = 0
b(7, 0) = 2
b(7, 1) = 1
b(8, 0) = 2
b(8, 1) = 2
b(9, 0) = 2
b(9, 1) = 3
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 100
Command1(i).Top = b(i, 0) * 600 + 200
Next i

End Sub

Private Sub Command5_Click()
Dim i, j As Integer
left_ok = False
right_ok = False
up_ok = False
down_ok = False

step_num = 3


For i = 0 To 4
 For j = 0 To 3
   a(i, j) = 1
 Next j
Next i
a(4, 1) = 0
a(4, 2) = 0

b(0, 0) = 0
b(0, 1) = 3
b(1, 0) = 0
b(1, 1) = 1
b(2, 0) = 3
b(2, 1) = 3
b(3, 0) = 0
b(3, 1) = 0
b(4, 0) = 2
b(4, 1) = 1
b(5, 0) = 3
b(5, 1) = 0
b(6, 0) = 3
b(6, 1) = 1
b(7, 0) = 3
b(7, 1) = 2
b(8, 0) = 2
b(8, 1) = 0
b(9, 0) = 2
b(9, 1) = 3
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 100
Command1(i).Top = b(i, 0) * 600 + 200
Next i

End Sub

Private Sub Command6_Click()
Dim i, j As Integer
left_ok = False
right_ok = False
up_ok = False
down_ok = False

step_num = 4


For i = 0 To 4
 For j = 0 To 3
   a(i, j) = 1
 Next j
Next i
a(4, 1) = 0
a(4, 2) = 0

b(0, 0) = 1
b(0, 1) = 3
b(1, 0) = 0
b(1, 1) = 1
b(2, 0) = 3
b(2, 1) = 3
b(3, 0) = 1
b(3, 1) = 0
b(4, 0) = 2
b(4, 1) = 1
b(5, 0) = 3
b(5, 1) = 0
b(6, 0) = 3
b(6, 1) = 1
b(7, 0) = 3
b(7, 1) = 2
b(8, 0) = 0
b(8, 1) = 0
b(9, 0) = 0
b(9, 1) = 3
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 100
Command1(i).Top = b(i, 0) * 600 + 200
Next i


End Sub

Private Sub Command7_Click()
Dim i, j As Integer
left_ok = False
right_ok = False
up_ok = False
down_ok = False
'Frame1.Visible = False

step_num = 5



For i = 0 To 4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -