www.pudn.com > gameprg.zip > Form2.frm
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)
Form2.Left = Screen.Width / 2 - Form2.Width / 2
Form2.Top = Screen.Height / 2 - Form2.Height / 2
Image2(2).Picture = PictureClip1.GraphicCell(0)
Image2(1).Picture = PictureClip1.GraphicCell(0)
Image2(0).Picture = PictureClip1.GraphicCell(0)
If Me.Picture <> 0 Then Call SetAutoRgn(Me)
'Me.Picture = LoadPicture(App.Path & "\main.bmp")
Me.Picture = PictureClip3.GraphicCell(0)
End Sub
Function check_me(Index As Integer)
Select Case Index
Case 0, 2, 3, 5
If b(Index, 1) > 0 Then
If a(b(Index, 0), b(Index, 1) - 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) - 1) = 0 Then
left_ok = True
End If
End If
If b(Index, 1) < 3 Then
If a(b(Index, 0), b(Index, 1) + 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 Then
right_ok = True
End If
End If
If b(Index, 0) > 0 Then
If a(b(Index, 0) - 1, b(Index, 1)) = 0 Then
up_ok = True
End If
End If
If b(Index, 0) < 3 Then
If a(b(Index, 0) + 2, b(Index, 1)) = 0 Then
down_ok = True
End If
End If
Case 1
If b(Index, 1) > 0 Then
If a(b(Index, 0), b(Index, 1) - 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) - 1) = 0 Then
left_ok = True
End If
End If
If b(Index, 1) < 2 Then
If a(b(Index, 0), b(Index, 1) + 2) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 2) = 0 Then
right_ok = True
End If
End If
If b(Index, 0) > 0 Then
If a(b(Index, 0) - 1, b(Index, 1)) = 0 And a(b(Index, 0) - 1, b(Index, 1) + 1) = 0 Then
up_ok = True
End If
End If
If b(Index, 0) < 3 Then
If a(b(Index, 0) + 2, b(Index, 1)) = 0 And a(b(Index, 0) + 2, b(Index, 1) + 1) = 0 Then
down_ok = True
End If
End If
Case 4
If b(Index, 1) > 0 Then
If a(b(Index, 0), b(Index, 1) - 1) = 0 Then
left_ok = True
End If
End If
If b(Index, 1) < 2 Then
If a(b(Index, 0), b(Index, 1) + 2) = 0 Then
right_ok = True
End If
End If
If b(Index, 0) > 0 Then
If a(b(Index, 0) - 1, b(Index, 1)) = 0 And a(b(Index, 0) - 1, b(Index, 1) + 1) = 0 Then
up_ok = True
End If
End If
If b(Index, 0) < 4 Then
If a(b(Index, 0) + 1, b(Index, 1)) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 Then
down_ok = True
End If
End If
Case 6, 7, 8, 9
If b(Index, 1) > 0 Then
If a(b(Index, 0), b(Index, 1) - 1) = 0 Then
left_ok = True
End If
End If
If b(Index, 1) < 3 Then
If a(b(Index, 0), b(Index, 1) + 1) = 0 Then
right_ok = True
End If
End If
If b(Index, 0) > 0 Then
If a(b(Index, 0) - 1, b(Index, 1)) = 0 Then
up_ok = True
End If
End If
If b(Index, 0) < 4 Then
If a(b(Index, 0) + 1, b(Index, 1)) = 0 Then
down_ok = True
End If
End If
End Select
End Function
Function move_left(Index As Integer)
Command1(Index).Left = Command1(Index).Left - 600
step1 = step1 + 1
If step1 > 9 Then
If step1 > 99 Then
If step1 > 999 Then
Else
Image2(2).Picture = PictureClip1.GraphicCell(Int(step1 / 100))
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10) Mod 10)
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10))
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(0).Picture = PictureClip1.GraphicCell(step1)
End If
Select Case Index
Case 0, 2, 3, 5
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0) + 1, b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) - 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0) + 1, b(Index, 1)) = 1
Case 1
a(b(Index, 0), b(Index, 1) + 1) = 0
a(b(Index, 0) + 1, b(Index, 1) + 1) = 0
b(Index, 1) = b(Index, 1) - 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0) + 1, b(Index, 1)) = 1
Case 4
a(b(Index, 0), b(Index, 1) + 1) = 0
b(Index, 1) = b(Index, 1) - 1
a(b(Index, 0), b(Index, 1)) = 1
Case 6, 7, 8, 9
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) - 1
a(b(Index, 0), b(Index, 1)) = 1
End Select
Data1.Recordset.AddNew
Data1.Recordset("aa") = step1
Data1.Recordset("b00") = b(0, 0)
Data1.Recordset("b01") = b(0, 1)
Data1.Recordset("b10") = b(1, 0)
Data1.Recordset("b11") = b(1, 1)
Data1.Recordset("b20") = b(2, 0)
Data1.Recordset("b21") = b(2, 1)
Data1.Recordset("b30") = b(3, 0)
Data1.Recordset("b31") = b(3, 1)
Data1.Recordset("b40") = b(4, 0)
Data1.Recordset("b41") = b(4, 1)
Data1.Recordset("b50") = b(5, 0)
Data1.Recordset("b51") = b(5, 1)
Data1.Recordset("b60") = b(6, 0)
Data1.Recordset("b61") = b(6, 1)
Data1.Recordset("b70") = b(7, 0)
Data1.Recordset("b71") = b(7, 1)
Data1.Recordset("b80") = b(8, 0)
Data1.Recordset("b81") = b(8, 1)
Data1.Recordset("b90") = b(9, 0)
Data1.Recordset("b91") = b(9, 1)
Data1.Recordset("a00") = a(0, 0)
Data1.Recordset("a01") = a(0, 1)
Data1.Recordset("a02") = a(0, 2)
Data1.Recordset("a03") = a(0, 3)
Data1.Recordset("a10") = a(1, 0)
Data1.Recordset("a11") = a(1, 1)
Data1.Recordset("a12") = a(1, 2)
Data1.Recordset("a13") = a(1, 3)
Data1.Recordset("a20") = a(2, 0)
Data1.Recordset("a21") = a(2, 1)
Data1.Recordset("a22") = a(2, 2)
Data1.Recordset("a23") = a(2, 3)
Data1.Recordset("a30") = a(3, 0)
Data1.Recordset("a31") = a(3, 1)
Data1.Recordset("a32") = a(3, 2)
Data1.Recordset("a33") = a(3, 3)
Data1.Recordset("a40") = a(4, 0)
Data1.Recordset("a41") = a(4, 1)
Data1.Recordset("a42") = a(4, 2)
Data1.Recordset("a43") = a(4, 3)
Data1.UpdateRecord
down_ok = False
up_ok = False
left_ok = False
right_ok = False
End Function
Function move_right(Index As Integer)
Command1(Index).Left = Command1(Index).Left + 600
step1 = step1 + 1
If step1 > 9 Then
If step1 > 99 Then
If step1 > 999 Then
Else
Image2(2).Picture = PictureClip1.GraphicCell(Int(step1 / 100))
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10) Mod 10)
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10))
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(0).Picture = PictureClip1.GraphicCell(step1)
End If
Select Case Index
Case 0, 2, 3, 5
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0) + 1, b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) + 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0) + 1, b(Index, 1)) = 1
Case 1
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0) + 1, b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) + 1
a(b(Index, 0), b(Index, 1) + 1) = 1
a(b(Index, 0) + 1, b(Index, 1) + 1) = 1
Case 4
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) + 1
a(b(Index, 0), b(Index, 1) + 1) = 1
Case 6, 7, 8, 9
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 1) = b(Index, 1) + 1
a(b(Index, 0), b(Index, 1)) = 1
End Select
Data1.Recordset.AddNew
Data1.Recordset("aa") = step1
Data1.Recordset("b00") = b(0, 0)
Data1.Recordset("b01") = b(0, 1)
Data1.Recordset("b10") = b(1, 0)
Data1.Recordset("b11") = b(1, 1)
Data1.Recordset("b20") = b(2, 0)
Data1.Recordset("b21") = b(2, 1)
Data1.Recordset("b30") = b(3, 0)
Data1.Recordset("b31") = b(3, 1)
Data1.Recordset("b40") = b(4, 0)
Data1.Recordset("b41") = b(4, 1)
Data1.Recordset("b50") = b(5, 0)
Data1.Recordset("b51") = b(5, 1)
Data1.Recordset("b60") = b(6, 0)
Data1.Recordset("b61") = b(6, 1)
Data1.Recordset("b70") = b(7, 0)
Data1.Recordset("b71") = b(7, 1)
Data1.Recordset("b80") = b(8, 0)
Data1.Recordset("b81") = b(8, 1)
Data1.Recordset("b90") = b(9, 0)
Data1.Recordset("b91") = b(9, 1)
Data1.Recordset("a00") = a(0, 0)
Data1.Recordset("a01") = a(0, 1)
Data1.Recordset("a02") = a(0, 2)
Data1.Recordset("a03") = a(0, 3)
Data1.Recordset("a10") = a(1, 0)
Data1.Recordset("a11") = a(1, 1)
Data1.Recordset("a12") = a(1, 2)
Data1.Recordset("a13") = a(1, 3)
Data1.Recordset("a20") = a(2, 0)
Data1.Recordset("a21") = a(2, 1)
Data1.Recordset("a22") = a(2, 2)
Data1.Recordset("a23") = a(2, 3)
Data1.Recordset("a30") = a(3, 0)
Data1.Recordset("a31") = a(3, 1)
Data1.Recordset("a32") = a(3, 2)
Data1.Recordset("a33") = a(3, 3)
Data1.Recordset("a40") = a(4, 0)
Data1.Recordset("a41") = a(4, 1)
Data1.Recordset("a42") = a(4, 2)
Data1.Recordset("a43") = a(4, 3)
Data1.UpdateRecord
down_ok = False
up_ok = False
left_ok = False
right_ok = False
End Function
Function move_down(Index As Integer)
Command1(Index).Top = Command1(Index).Top + 600
step1 = step1 + 1
If step1 > 9 Then
If step1 > 99 Then
If step1 > 999 Then
Else
Image2(2).Picture = PictureClip1.GraphicCell(Int(step1 / 100))
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10) Mod 10)
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10))
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(0).Picture = PictureClip1.GraphicCell(step1)
End If
Select Case Index
Case 0, 2, 3, 5
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 0) = b(Index, 0) + 1
a(b(Index, 0) + 1, b(Index, 1)) = 1
Case 1
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0), b(Index, 1) + 1) = 0
b(Index, 0) = b(Index, 0) + 1
a(b(Index, 0) + 1, b(Index, 1)) = 1
a(b(Index, 0) + 1, b(Index, 1) + 1) = 1
Case 4
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0), b(Index, 1) + 1) = 0
b(Index, 0) = b(Index, 0) + 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0), b(Index, 1) + 1) = 1
Case 6, 7, 8, 9
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 0) = b(Index, 0) + 1
a(b(Index, 0), b(Index, 1)) = 1
End Select
Data1.Recordset.AddNew
Data1.Recordset("aa") = step1
Data1.Recordset("b00") = b(0, 0)
Data1.Recordset("b01") = b(0, 1)
Data1.Recordset("b10") = b(1, 0)
Data1.Recordset("b11") = b(1, 1)
Data1.Recordset("b20") = b(2, 0)
Data1.Recordset("b21") = b(2, 1)
Data1.Recordset("b30") = b(3, 0)
Data1.Recordset("b31") = b(3, 1)
Data1.Recordset("b40") = b(4, 0)
Data1.Recordset("b41") = b(4, 1)
Data1.Recordset("b50") = b(5, 0)
Data1.Recordset("b51") = b(5, 1)
Data1.Recordset("b60") = b(6, 0)
Data1.Recordset("b61") = b(6, 1)
Data1.Recordset("b70") = b(7, 0)
Data1.Recordset("b71") = b(7, 1)
Data1.Recordset("b80") = b(8, 0)
Data1.Recordset("b81") = b(8, 1)
Data1.Recordset("b90") = b(9, 0)
Data1.Recordset("b91") = b(9, 1)
Data1.Recordset("a00") = a(0, 0)
Data1.Recordset("a01") = a(0, 1)
Data1.Recordset("a02") = a(0, 2)
Data1.Recordset("a03") = a(0, 3)
Data1.Recordset("a10") = a(1, 0)
Data1.Recordset("a11") = a(1, 1)
Data1.Recordset("a12") = a(1, 2)
Data1.Recordset("a13") = a(1, 3)
Data1.Recordset("a20") = a(2, 0)
Data1.Recordset("a21") = a(2, 1)
Data1.Recordset("a22") = a(2, 2)
Data1.Recordset("a23") = a(2, 3)
Data1.Recordset("a30") = a(3, 0)
Data1.Recordset("a31") = a(3, 1)
Data1.Recordset("a32") = a(3, 2)
Data1.Recordset("a33") = a(3, 3)
Data1.Recordset("a40") = a(4, 0)
Data1.Recordset("a41") = a(4, 1)
Data1.Recordset("a42") = a(4, 2)
Data1.Recordset("a43") = a(4, 3)
Data1.UpdateRecord
down_ok = False
up_ok = False
left_ok = False
right_ok = False
End Function
Function move_up(Index As Integer)
Command1(Index).Top = Command1(Index).Top - 600
step1 = step1 + 1
If step1 > 9 Then
If step1 > 99 Then
If step1 > 999 Then
Else
Image2(2).Picture = PictureClip1.GraphicCell(Int(step1 / 100))
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10) Mod 10)
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10))
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(0).Picture = PictureClip1.GraphicCell(step1)
End If
Select Case Index
Case 0, 2, 3, 5
a(b(Index, 0) + 1, b(Index, 1)) = 0
b(Index, 0) = b(Index, 0) - 1
a(b(Index, 0), b(Index, 1)) = 1
Case 1
a(b(Index, 0) + 1, b(Index, 1)) = 0
a(b(Index, 0) + 1, b(Index, 1) + 1) = 0
b(Index, 0) = b(Index, 0) - 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0), b(Index, 1) + 1) = 1
Case 4
a(b(Index, 0), b(Index, 1)) = 0
a(b(Index, 0), b(Index, 1) + 1) = 0
b(Index, 0) = b(Index, 0) - 1
a(b(Index, 0), b(Index, 1)) = 1
a(b(Index, 0), b(Index, 1) + 1) = 1
Case 6, 7, 8, 9
a(b(Index, 0), b(Index, 1)) = 0
b(Index, 0) = b(Index, 0) - 1
a(b(Index, 0), b(Index, 1)) = 1
End Select
Data1.Recordset.AddNew
Data1.Recordset("aa") = step1
Data1.Recordset("b00") = b(0, 0)
Data1.Recordset("b01") = b(0, 1)
Data1.Recordset("b10") = b(1, 0)
Data1.Recordset("b11") = b(1, 1)
Data1.Recordset("b20") = b(2, 0)
Data1.Recordset("b21") = b(2, 1)
Data1.Recordset("b30") = b(3, 0)
Data1.Recordset("b31") = b(3, 1)
Data1.Recordset("b40") = b(4, 0)
Data1.Recordset("b41") = b(4, 1)
Data1.Recordset("b50") = b(5, 0)
Data1.Recordset("b51") = b(5, 1)
Data1.Recordset("b60") = b(6, 0)
Data1.Recordset("b61") = b(6, 1)
Data1.Recordset("b70") = b(7, 0)
Data1.Recordset("b71") = b(7, 1)
Data1.Recordset("b80") = b(8, 0)
Data1.Recordset("b81") = b(8, 1)
Data1.Recordset("b90") = b(9, 0)
Data1.Recordset("b91") = b(9, 1)
Data1.Recordset("a00") = a(0, 0)
Data1.Recordset("a01") = a(0, 1)
Data1.Recordset("a02") = a(0, 2)
Data1.Recordset("a03") = a(0, 3)
Data1.Recordset("a10") = a(1, 0)
Data1.Recordset("a11") = a(1, 1)
Data1.Recordset("a12") = a(1, 2)
Data1.Recordset("a13") = a(1, 3)
Data1.Recordset("a20") = a(2, 0)
Data1.Recordset("a21") = a(2, 1)
Data1.Recordset("a22") = a(2, 2)
Data1.Recordset("a23") = a(2, 3)
Data1.Recordset("a30") = a(3, 0)
Data1.Recordset("a31") = a(3, 1)
Data1.Recordset("a32") = a(3, 2)
Data1.Recordset("a33") = a(3, 3)
Data1.Recordset("a40") = a(4, 0)
Data1.Recordset("a41") = a(4, 1)
Data1.Recordset("a42") = a(4, 2)
Data1.Recordset("a43") = a(4, 3)
Data1.UpdateRecord
down_ok = False
up_ok = False
left_ok = False
right_ok = False
End Function
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'移动窗体
If Button = vbLeftButton Then
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
'If Button = vbRightButton Then
'PopupMenu Form1.mainmenu
'End If
End Sub
Private Sub Image1_Click(Index As Integer)
Dim no1 As String
Dim i As Integer
Select Case Index
Case 1
Unload Me
End
Case 0
Me.WindowState = 1
Case 2
If step_num = 1 Then
step_num = 1
Else
step_num = step_num - 1
End If
Image3.Picture = PictureClip2.GraphicCell(step_num - 1)
Select Case step_num
Case 1
Call Command3_Click
Case 2
Call Command4_Click
Case 3
Call Command6_Click
Case 4
Call Command7_Click
'Case 5
'Call Command7_Click
End Select
step1 = 0
load_flag = False
Data1.Database.Execute ("delete * from step")
Case 3
If step_num = 4 Then
step_num = 4
Else
step_num = step_num + 1
End If
Image3.Picture = PictureClip2.GraphicCell(step_num - 1)
Select Case step_num
Case 1
Call Command3_Click
Case 2
Call Command4_Click
Case 3
Call Command6_Click
Case 4
Call Command7_Click
'Case 5
'Call Command7_Click
End Select
step1 = 0
load_flag = False
Data1.Database.Execute ("delete * from step")
Case 4
Select Case step_num
Case 1
Call Command3_Click
Case 2
Call Command4_Click
Case 3
Call Command6_Click
Case 4
Call Command7_Click
End Select
step1 = 0
load_flag = False
Data1.Database.Execute ("delete * from step")
Case 5
Form3.Show 1, Me
If load_flag Then
Image3.Picture = PictureClip2.GraphicCell(game_num - 1)
Data1.RecordSource = "select * from step"
Data1.Refresh
Data1.Recordset.MoveFirst
b(0, 0) = Data1.Recordset("b00")
b(0, 1) = Data1.Recordset("b01")
b(1, 0) = Data1.Recordset("b10")
b(1, 1) = Data1.Recordset("b11")
b(2, 0) = Data1.Recordset("b20")
b(2, 1) = Data1.Recordset("b21")
b(3, 0) = Data1.Recordset("b30")
b(3, 1) = Data1.Recordset("b31")
b(4, 0) = Data1.Recordset("b40")
b(4, 1) = Data1.Recordset("b41")
b(5, 0) = Data1.Recordset("b50")
b(5, 1) = Data1.Recordset("b51")
b(6, 0) = Data1.Recordset("b60")
b(6, 1) = Data1.Recordset("b61")
b(7, 0) = Data1.Recordset("b70")
b(7, 1) = Data1.Recordset("b71")
b(8, 0) = Data1.Recordset("b80")
b(8, 1) = Data1.Recordset("b81")
b(9, 0) = Data1.Recordset("b90")
b(9, 1) = Data1.Recordset("b91")
a(0, 0) = Data1.Recordset("a00")
a(0, 1) = Data1.Recordset("a01")
a(0, 2) = Data1.Recordset("a02")
a(1, 0) = Data1.Recordset("a10")
a(1, 1) = Data1.Recordset("a11")
a(1, 2) = Data1.Recordset("a12")
a(2, 0) = Data1.Recordset("a20")
a(2, 1) = Data1.Recordset("a21")
a(2, 2) = Data1.Recordset("a22")
a(3, 0) = Data1.Recordset("a30")
a(3, 1) = Data1.Recordset("a31")
a(3, 2) = Data1.Recordset("a32")
a(4, 0) = Data1.Recordset("a40")
a(4, 1) = Data1.Recordset("a41")
a(4, 2) = Data1.Recordset("a42")
a(0, 3) = Data1.Recordset("a03")
a(1, 3) = Data1.Recordset("a13")
a(2, 3) = Data1.Recordset("a23")
a(3, 3) = Data1.Recordset("a33")
a(4, 3) = Data1.Recordset("a43")
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
Next i
step1 = 1
End If
Case 8
If load_flag Then
step1 = step1 + 1
If step1 > max_step Then
step1 = max_step
MsgBox "最后一步!"
Exit Sub
End If
Data1.RecordSource = "select * from step where aa=" & "'" & step1 & "'"
Data1.Refresh
b(0, 0) = Data1.Recordset("b00")
b(0, 1) = Data1.Recordset("b01")
b(1, 0) = Data1.Recordset("b10")
b(1, 1) = Data1.Recordset("b11")
b(2, 0) = Data1.Recordset("b20")
b(2, 1) = Data1.Recordset("b21")
b(3, 0) = Data1.Recordset("b30")
b(3, 1) = Data1.Recordset("b31")
b(4, 0) = Data1.Recordset("b40")
b(4, 1) = Data1.Recordset("b41")
b(5, 0) = Data1.Recordset("b50")
b(5, 1) = Data1.Recordset("b51")
b(6, 0) = Data1.Recordset("b60")
b(6, 1) = Data1.Recordset("b61")
b(7, 0) = Data1.Recordset("b70")
b(7, 1) = Data1.Recordset("b71")
b(8, 0) = Data1.Recordset("b80")
b(8, 1) = Data1.Recordset("b81")
b(9, 0) = Data1.Recordset("b90")
b(9, 1) = Data1.Recordset("b91")
a(0, 0) = Data1.Recordset("a00")
a(0, 1) = Data1.Recordset("a01")
a(0, 2) = Data1.Recordset("a02")
a(1, 0) = Data1.Recordset("a10")
a(1, 1) = Data1.Recordset("a11")
a(1, 2) = Data1.Recordset("a12")
a(2, 0) = Data1.Recordset("a20")
a(2, 1) = Data1.Recordset("a21")
a(2, 2) = Data1.Recordset("a22")
a(3, 0) = Data1.Recordset("a30")
a(3, 1) = Data1.Recordset("a31")
a(3, 2) = Data1.Recordset("a32")
a(4, 0) = Data1.Recordset("a40")
a(4, 1) = Data1.Recordset("a41")
a(4, 2) = Data1.Recordset("a42")
a(0, 3) = Data1.Recordset("a03")
a(1, 3) = Data1.Recordset("a13")
a(2, 3) = Data1.Recordset("a23")
a(3, 3) = Data1.Recordset("a33")
a(4, 3) = Data1.Recordset("a43")
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
Next i
End If
Case 6
frmAbout.Show 1, Me
Case 7
Form1.Show 1, Me
Case 9
If step1 < 0 Then
Exit Sub
End If
Data1.RecordSource = "select * from step where aa=" & "'" & step1 & "'"
Data1.Refresh
If Data1.Recordset.RecordCount < 1 Then
Exit Sub
Else
If step1 = 1 Then
Select Case step_num
Case 1
Call Command3_Click
Case 2
Call Command4_Click
Case 3
Call Command6_Click
Case 4
Call Command7_Click
End Select
step1 = 0
Else
Data1.Database.Execute ("delete * from step where aa=" & "'" & step1 & "'")
Data1.RecordSource = "select * from step"
Data1.Refresh
Data1.Recordset.MoveLast
b(0, 0) = Data1.Recordset("b00")
b(0, 1) = Data1.Recordset("b01")
b(1, 0) = Data1.Recordset("b10")
b(1, 1) = Data1.Recordset("b11")
b(2, 0) = Data1.Recordset("b20")
b(2, 1) = Data1.Recordset("b21")
b(3, 0) = Data1.Recordset("b30")
b(3, 1) = Data1.Recordset("b31")
b(4, 0) = Data1.Recordset("b40")
b(4, 1) = Data1.Recordset("b41")
b(5, 0) = Data1.Recordset("b50")
b(5, 1) = Data1.Recordset("b51")
b(6, 0) = Data1.Recordset("b60")
b(6, 1) = Data1.Recordset("b61")
b(7, 0) = Data1.Recordset("b70")
b(7, 1) = Data1.Recordset("b71")
b(8, 0) = Data1.Recordset("b80")
b(8, 1) = Data1.Recordset("b81")
b(9, 0) = Data1.Recordset("b90")
b(9, 1) = Data1.Recordset("b91")
a(0, 0) = Data1.Recordset("a00")
a(0, 1) = Data1.Recordset("a01")
a(0, 2) = Data1.Recordset("a02")
a(1, 0) = Data1.Recordset("a10")
a(1, 1) = Data1.Recordset("a11")
a(1, 2) = Data1.Recordset("a12")
a(2, 0) = Data1.Recordset("a20")
a(2, 1) = Data1.Recordset("a21")
a(2, 2) = Data1.Recordset("a22")
a(3, 0) = Data1.Recordset("a30")
a(3, 1) = Data1.Recordset("a31")
a(3, 2) = Data1.Recordset("a32")
a(4, 0) = Data1.Recordset("a40")
a(4, 1) = Data1.Recordset("a41")
a(4, 2) = Data1.Recordset("a42")
a(0, 3) = Data1.Recordset("a03")
a(1, 3) = Data1.Recordset("a13")
a(2, 3) = Data1.Recordset("a23")
a(3, 3) = Data1.Recordset("a33")
a(4, 3) = Data1.Recordset("a43")
End If
For i = 0 To 9
Command1(i).Left = b(i, 1) * 600 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
Next i
If step1 = 0 Then
step1 = 0
Else
step1 = step1 - 1
End If
End If
End Select
Image2(2).Picture = PictureClip1.GraphicCell(0)
Image2(1).Picture = PictureClip1.GraphicCell(0)
Image2(0).Picture = PictureClip1.GraphicCell(0)
If step1 > 9 Then
If step1 > 99 Then
If step1 > 999 Then
Else
Image2(2).Picture = PictureClip1.GraphicCell(Int(step1 / 100))
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10) Mod 10)
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(1).Picture = PictureClip1.GraphicCell(Int(step1 / 10))
Image2(0).Picture = PictureClip1.GraphicCell(Int(step1 Mod 10))
End If
Else
Image2(0).Picture = PictureClip1.GraphicCell(step1)
End If
'Data1.RecordSource = "select * from step"
'Data1.Refresh
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 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
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 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
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
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 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
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
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 + 1250
Command1(i).Top = b(i, 0) * 600 + 1160
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
For i = 0 To 4
For j = 0 To 3
a(i, j) = 1
Next j
Next i
a(4, 3) = 0
a(4, 2) = 0
b(0, 0) = 0
b(0, 1) = 3
b(1, 0) = 0
b(1, 1) = 0
b(2, 0) = 3
b(2, 1) = 1
b(3, 0) = 0
b(3, 1) = 2
b(4, 0) = 2
b(4, 1) = 0
b(5, 0) = 3
b(5, 1) = 0
b(6, 0) = 2
b(6, 1) = 2
b(7, 0) = 2
b(7, 1) = 3
b(8, 0) = 3
b(8, 1) = 2
b(9, 0) = 3
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
End Sub