📄 pcl.frm
字号:
VERSION 5.00
Object = "{D98894A2-CB0A-11D1-ACBE-0000E8167669}#6.0#0"; "TILEPUZ.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "拼图"
ClientHeight = 4470
ClientLeft = 165
ClientTop = 450
ClientWidth = 3330
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "pcl.frx":0000
ScaleHeight = 4470
ScaleWidth = 3330
StartUpPosition = 2 '屏幕中心
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 3480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = "*.jpg"
End
Begin Project1.TilePuzzle TilePuzzle1
Height = 4500
Left = 120
TabIndex = 0
Top = 3120
Visible = 0 'False
Width = 3345
_ExtentX = 5900
_ExtentY = 7938
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 1
Left = 240
TabIndex = 2
Top = 2640
Visible = 0 'False
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 0
Left = 960
TabIndex = 1
Top = 2640
Visible = 0 'False
Width = 540
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 4500
Left = 0
Picture = "pcl.frx":4CB7
Stretch = -1 'True
Top = 0
Width = 3345
End
Begin VB.Menu play
Caption = "游戏选项"
Begin VB.Menu p1
Caption = "游戏开始"
End
Begin VB.Menu p2
Caption = "图像装载"
End
Begin VB.Menu p3
Caption = "游戏难度"
Begin VB.Menu p30
Caption = "初级"
Checked = -1 'True
Shortcut = {F1}
End
Begin VB.Menu p31
Caption = "中级"
Shortcut = {F2}
End
Begin VB.Menu p32
Caption = "高级"
Shortcut = {F3}
End
End
Begin VB.Menu p4
Caption = "风云榜"
End
Begin VB.Menu p5
Caption = "游戏结束"
Shortcut = ^Q
End
End
Begin VB.Menu iy
Caption = "注意事项"
Begin VB.Menu h3
Caption = "拼图游戏欢迎您"
End
Begin VB.Menu h1
Caption = "请使用220*300的图像"
End
Begin VB.Menu h2
Caption = "不要使用过大的图像 "
End
End
Begin VB.Menu 关于
Caption = "关于"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i, j, Moves As Integer '定义变量i,j为整型并且指定了对象是否可移动
Dim filename, pic, temp, Line_text, m As String
Private Sub Form_Load()
TilePuzzle1.Top = Image1.Top
TilePuzzle1.Left = Image1.Left
Set TilePuzzle1.Picture = Image1.Picture
i = 2
j = 2
End Sub
Private Sub Image1_Click()
End Sub
Private Sub p1_Click() '游戏开始
Set TilePuzzle1.Picture = Image1.Picture
TilePuzzle1.Cols = i
TilePuzzle1.Rows = j
i = TilePuzzle1.Cols
j = TilePuzzle1.Rows
Image1.Visible = False
TilePuzzle1.Randomize
TilePuzzle1.Visible = True
p1.Caption = "重新开始"
End Sub
Private Sub p2_Click() '图片加载
CommonDialog1.Filter = "Jpg(*.jpg)|*.jpg|Gif(*.gif)|*.gif" 'CommonDialog控件加载图片
CommonDialog1.ShowOpen
pic = CommonDialog1.filename
If pic <> "" Then 'pic的图片是否等于空
Image1.Picture = LoadPicture(pic) '加载图片,使图片框1的图片=pic加载的图片
TilePuzzle1.Visible = False
Image1.Visible = True '加载的图片为可见
i = 2
j = 2
Me.Caption = "拼图 "
End If
End Sub
Private Sub p30_Click()
i = 2
j = 2
p30.Checked = True '决定在初级菜单项旁边有一个复选标记
p31.Checked = False '在中级菜单没有复选标记
p32.Checked = False '在高级菜单没有复选标记
End Sub
Private Sub p31_Click()
i = 3
j = 3
p30.Checked = False
p31.Checked = True
p32.Checked = False
End Sub
Private Sub p32_Click()
i = 4
j = 4
p30.Checked = False
p31.Checked = False
p32.Checked = True
End Sub
Private Sub p4_Click()
Form2.Show
Me.Enabled = False
End Sub
Private Sub p5_Click()
End
End Sub
Private Sub TilePuzzle1_Moved()
Moves = Moves + 1
Me.Caption = "拼图 共走" + Format$(Moves) + "步"
End Sub
Private Sub TilePuzzle1_Solved()
If i = 2 Then
p31.Checked = True
p30.Checked = False
p32.Checked = False
End If
If i = 3 Then
p31.Checked = False
p30.Checked = False
p32.Checked = True
End If
Label1(0).Caption = Moves
temp = Str(i - 1) + ".txt"
Label1(1).Caption = temp
filename = Dir(temp)
If filename = "" Then
frmLogin.Show
Else
Open temp For Input As #1
Line Input #1, Line_text
m = Left(Line_text, InStr(1, Line_text, "!") - 1)
Close #1
If CInt(m) > Moves Then frmLogin.Show
End If
Me.Caption = "拼图 "
TilePuzzle1.Cols = i + 1
TilePuzzle1.Rows = j + 1
i = TilePuzzle1.Cols
j = TilePuzzle1.Rows
TilePuzzle1.Randomize
End Sub
Private Sub y2_Click()
Y2.Checked = True
Y1.Checked = False
End Sub
Private Sub 关于_Click()
MsgBox " 拼图游戏 " + Chr(13) + Chr(13) + "------欢迎您使用本程序!" + Chr(13) + Chr(13) + " 谢谢使用。 " + Chr(13) + Chr(13) + " 2004 - 11", 64
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -