【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-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 = 4305
ClientLeft = 165
ClientTop = 450
ClientWidth = 4305
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 4305
StartUpPosition = 1 '所有者中心
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 3480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = "*.jpg"
End
Begin Project1.TilePuzzle TilePuzzle1
Height = 780
Left = 1320
TabIndex = 0
Top = 3000
Visible = 0 'False
Width = 1035
_ExtentX = 1826
_ExtentY = 1376
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
BorderStyle = 1 'Fixed Single
Height = 4305
Left = 0
Picture = "pcl.frx":0000
Stretch = -1 'True
Top = 0
Width = 4305
End
Begin VB.Menu play
Caption = "拼图游戏选项(&P)"
Begin VB.Menu p1
Caption = "游戏开始"
Shortcut = {F2}
End
Begin VB.Menu p2
Caption = "图像装载"
Shortcut = {F3}
End
Begin VB.Menu p3
Caption = "游戏难度"
Begin VB.Menu p30
Caption = "初级"
Checked = -1 'True
End
Begin VB.Menu p31
Caption = "中级"
End
Begin
VB.Menu p32
Caption = "高级"
End
End
Begin VB.Menu p4
Caption = "游戏高手榜"
End
Begin VB.Menu iy
Caption = "注意事项"
Begin VB.Menu h1
Caption = "请使用220*300的图像"
End
Begin VB.Menu h2
Caption = "不要使用过大的图像"
End
Begin VB.Menu h3
Caption = "VB爱好者乐园欢迎您"
End
End
Begin VB.Menu p5
Caption = "游戏结束"
Shortcut = ^Q
End
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
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 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"
CommonDialog1.ShowOpen
pic = CommonDialog1.filename
If pic <> "" Then
Image1.Picture = LoadPicture(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