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

📄 form2.frm

📁 用vb编写的华容道游戏
💻 FRM
📖 第 1 页 / 共 3 页
字号:
VERSION 5.00
Object = "{27395F88-0C0C-101B-A3C9-08002B2F49FB}#1.1#0"; "PICCLP32.OCX"
Begin VB.Form Form2 
   BorderStyle     =   0  'None
   ClientHeight    =   6015
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6030
   ControlBox      =   0   'False
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "Form2.frx":030A
   ScaleHeight     =   6015
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin PicClip.PictureClip PictureClip3 
      Left            =   0
      Top             =   6120
      _ExtentX        =   10583
      _ExtentY        =   10583
      _Version        =   393216
      Picture         =   "Form2.frx":2784C
   End
   Begin PicClip.PictureClip PictureClip2 
      Left            =   480
      Top             =   6120
      _ExtentX        =   8043
      _ExtentY        =   5583
      _Version        =   393216
      Cols            =   4
      Picture         =   "Form2.frx":35E8B
   End
   Begin PicClip.PictureClip PictureClip1 
      Left            =   600
      Top             =   360
      _ExtentX        =   4524
      _ExtentY        =   767
      _Version        =   393216
      Cols            =   10
      Picture         =   "Form2.frx":64E8D
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   3600
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   4680
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Appearance      =   0  'Flat
      Height          =   200
      Index           =   1
      Left            =   1440
      Picture         =   "Form2.frx":68953
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   4440
      Visible         =   0   'False
      Width           =   200
   End
   Begin VB.CommandButton Command2 
      Appearance      =   0  'Flat
      Height          =   200
      Index           =   3
      Left            =   1200
      Picture         =   "Form2.frx":68AFD
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   4680
      Visible         =   0   'False
      Width           =   200
   End
   Begin VB.CommandButton Command2 
      Appearance      =   0  'Flat
      Height          =   200
      Index           =   5
      Left            =   1920
      Picture         =   "Form2.frx":68C7F
      Style           =   1  'Graphical
      TabIndex        =   11
      Top             =   4680
      Visible         =   0   'False
      Width           =   200
   End
   Begin VB.CommandButton Command2 
      Appearance      =   0  'Flat
      Height          =   200
      Index           =   7
      Left            =   1440
      Picture         =   "Form2.frx":68E29
      Style           =   1  'Graphical
      TabIndex        =   10
      Top             =   5160
      Visible         =   0   'False
      Width           =   200
   End
   Begin VB.CommandButton Command1 
      Height          =   600
      Index           =   9
      Left            =   3120
      Picture         =   "Form2.frx":68FFB
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   3600
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Height          =   600
      Index           =   8
      Left            =   2520
      Picture         =   "Form2.frx":695A0
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   3000
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Height          =   600
      Index           =   7
      Left            =   1920
      Picture         =   "Form2.frx":69B45
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   3000
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Height          =   600
      Index           =   6
      Left            =   1320
      Picture         =   "Form2.frx":6A0EA
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   3600
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Height          =   1200
      Index           =   5
      Left            =   3120
      Picture         =   "Form2.frx":6A68F
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   2400
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Appearance      =   0  'Flat
      Height          =   600
      Index           =   4
      Left            =   1920
      Picture         =   "Form2.frx":6AF02
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   2400
      Width           =   1200
   End
   Begin VB.CommandButton Command1 
      Height          =   1200
      Index           =   3
      Left            =   1320
      Picture         =   "Form2.frx":6B6C8
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   2400
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Height          =   1200
      Index           =   2
      Left            =   3120
      Picture         =   "Form2.frx":6BEF0
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1200
      Width           =   600
   End
   Begin VB.CommandButton Command1 
      Appearance      =   0  'Flat
      Height          =   1200
      Index           =   1
      Left            =   1920
      Picture         =   "Form2.frx":6C76C
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1200
      Width           =   1200
   End
   Begin VB.CommandButton Command1 
      Height          =   1200
      Index           =   0
      Left            =   1320
      Picture         =   "Form2.frx":6D44A
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   1200
      Width           =   600
   End
   Begin VB.Image Image1 
      Height          =   405
      Index           =   9
      Left            =   360
      MouseIcon       =   "Form2.frx":6DC8F
      MousePointer    =   99  'Custom
      ToolTipText     =   "退一步"
      Top             =   2880
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   405
      Index           =   8
      Left            =   360
      MouseIcon       =   "Form2.frx":6DDE1
      MousePointer    =   99  'Custom
      ToolTipText     =   "下一步"
      Top             =   3240
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   405
      Index           =   7
      Left            =   360
      MouseIcon       =   "Form2.frx":6DF33
      MousePointer    =   99  'Custom
      ToolTipText     =   "保存"
      Top             =   3840
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   405
      Index           =   6
      Left            =   360
      MouseIcon       =   "Form2.frx":6E085
      MousePointer    =   99  'Custom
      ToolTipText     =   "关于"
      Top             =   4560
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   405
      Index           =   5
      Left            =   360
      MouseIcon       =   "Form2.frx":6E1D7
      MousePointer    =   99  'Custom
      ToolTipText     =   "读取"
      Top             =   4200
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   525
      Index           =   4
      Left            =   5160
      MouseIcon       =   "Form2.frx":6E329
      MousePointer    =   99  'Custom
      ToolTipText     =   "重新开始"
      Top             =   1800
      Width           =   555
   End
   Begin VB.Image Image3 
      Height          =   3135
      Left            =   3800
      Top             =   1030
      Width           =   1095
   End
   Begin VB.Image Image2 
      Height          =   495
      Index           =   2
      Left            =   3960
      Top             =   4320
      Width           =   300
   End
   Begin VB.Image Image2 
      Height          =   495
      Index           =   1
      Left            =   4200
      Top             =   4320
      Width           =   300
   End
   Begin VB.Image Image2 
      Height          =   495
      Index           =   0
      Left            =   4440
      Top             =   4320
      Width           =   300
   End
   Begin VB.Image Image1 
      Height          =   645
      Index           =   3
      Left            =   5190
      MouseIcon       =   "Form2.frx":6E47B
      MousePointer    =   99  'Custom
      ToolTipText     =   "下一关"
      Top             =   2310
      Width           =   555
   End
   Begin VB.Image Image1 
      Height          =   585
      Index           =   2
      Left            =   5170
      MouseIcon       =   "Form2.frx":6E5CD
      MousePointer    =   99  'Custom
      ToolTipText     =   "上一关"
      Top             =   1220
      Width           =   540
   End
   Begin VB.Image Image1 
      Height          =   270
      Index           =   1
      Left            =   5300
      MouseIcon       =   "Form2.frx":6E71F
      MousePointer    =   99  'Custom
      ToolTipText     =   "关闭"
      Top             =   360
      Width           =   270
   End
   Begin VB.Image Image1 
      Height          =   270
      Index           =   0
      Left            =   5000
      MouseIcon       =   "Form2.frx":6E871
      MousePointer    =   99  'Custom
      ToolTipText     =   "最小化"
      Top             =   360
      Width           =   270
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click(Index As Integer)
Dim ok_num As Integer
load_flag = False
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 Form_Load()
Dim i, j As Integer
Data1.DatabaseName = App.Path & "\data.mdb"
Data1.RecordSource = "select * from step"
Data1.Refresh

Data1.Database.Execute ("delete * from step")

step_num = 1
left_ok = False
right_ok = False
up_ok = False
down_ok = False
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 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
Next i
Data1.RecordSource = "select * from step"
Data1.Refresh
Form2.BorderStyle = 0
Image3.Picture = PictureClip2.GraphicCell(0)

⌨️ 快捷键说明

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