frmform.frm
来自「《Visual Basic 6.0趣味程序导学》光盘」· FRM 代码 · 共 1,205 行 · 第 1/3 页
FRM
1,205 行
VERSION 5.00
Begin VB.Form frmForm
BackColor = &H00FFC0C0&
BorderStyle = 3 'Fixed Dialog
Caption = "俄罗斯方块"
ClientHeight = 7140
ClientLeft = 1275
ClientTop = 705
ClientWidth = 4950
Icon = "frmForm.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
Picture = "frmForm.frx":0442
ScaleHeight = 7140
ScaleWidth = 4950
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtLevel
BackColor = &H80000006&
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 420
Left = 840
TabIndex = 13
Text = "0"
Top = 5400
Width = 495
End
Begin VB.CommandButton cmdExit
Caption = "开始"
Height = 255
Left = 240
TabIndex = 12
TabStop = 0 'False
Top = 4560
Width = 1095
End
Begin VB.CommandButton cmdStart
Caption = "暂停"
Enabled = 0 'False
Height = 255
Left = 240
TabIndex = 11
TabStop = 0 'False
Top = 3840
Width = 1095
End
Begin VB.TextBox txtGrade
BackColor = &H80000006&
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 420
Left = 3600
Locked = -1 'True
TabIndex = 9
Text = "0"
Top = 0
Width = 1095
End
Begin VB.TextBox txtMark
BackColor = &H00000000&
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 420
Left = 840
Locked = -1 'True
TabIndex = 7
Text = "0"
Top = 0
Width = 1095
End
Begin VB.Frame Frame1
BackColor = &H00FF0000&
Caption = "下一块"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFC0&
Height = 2175
Left = 120
TabIndex = 3
Top = 960
Width = 1335
Begin VB.CommandButton Commannd1
Caption = "隐藏(&D)"
Height = 255
Left = 120
TabIndex = 6
TabStop = 0 'False
Top = 1800
Width = 1095
End
Begin VB.PictureBox picPictureNextBackGround
BackColor = &H00FFFFFF&
Height = 1335
Left = 120
ScaleHeight = 1275
ScaleWidth = 1050
TabIndex = 5
TabStop = 0 'False
Top = 360
Width = 1110
Begin VB.Image imgPictureNext
Height = 495
Left = 120
Top = 360
Width = 855
End
End
End
Begin VB.Timer tmrDrop
Enabled = 0 'False
Interval = 200
Left = 480
Top = 5640
End
Begin VB.PictureBox picBackGround
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "Arial"
Size = 26.25
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808000&
Height = 6030
Left = 1680
ScaleHeight = 20
ScaleMode = 0 'User
ScaleWidth = 10
TabIndex = 0
Top = 960
Width = 3030
Begin VB.PictureBox picPictureTemp
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00404040&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 480
Left = 1680
ScaleHeight = 480
ScaleWidth = 1080
TabIndex = 2
TabStop = 0 'False
Top = 120
Visible = 0 'False
Width = 1080
End
Begin VB.PictureBox picPictureNow
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00404040&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 480
ScaleHeight = 495
ScaleWidth = 975
TabIndex = 1
TabStop = 0 'False
Top = 120
Visible = 0 'False
Width = 975
End
End
Begin VB.Label Label4
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Level:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 14
Top = 5400
Width = 855
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Lines:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2880
TabIndex = 10
Top = 0
Width = 855
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Score:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 8
Top = 0
Width = 855
End
Begin VB.Label Label1
BackColor = &H00FF0000&
BorderStyle = 1 'Fixed Single
Caption = " 俄罗斯方块 Vision 1.0"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFC0FF&
Height = 855
Left = 120
TabIndex = 4
Top = 6120
Width = 1335
End
Begin VB.Image imgPictureNowBackup
Height = 375
Left = 960
Top = 5640
Visible = 0 'False
Width = 495
End
Begin VB.Menu mnuGame
Caption = "游戏(&G)"
Begin VB.Menu mnuGameNew
Caption = "新游戏(&N)"
End
Begin VB.Menu mnuGameExit
Caption = "退出(&X)"
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpKey
Caption = "键盘(&K)"
End
Begin VB.Menu mnuGameAbout
Caption = "关于(&A)"
End
End
End
Attribute VB_Name = "frmForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Type_Now As Integer '目前方块的类型
Dim Type_Next As Integer '下个方块的类型
Dim intRotate As Integer '方块旋转的状态
Function Get_X_Value()
If GetValue(1, 2) Then 'Get X Value
If MaxX - MinX >= 2 Then
If MaxX - CurX <= 1 Then
Adjust_Left = MaxX - 2 - 1
Else
Adjust_Left = CurX - 1
End If
Get_X_Value = True
Exit Function
End If
End If
Get_X_Value = False
End Function
Function GetValue(nType As Integer, nWid As Integer)
GetCoor
On Error Resume Next
Dim OKCount, EmptyCount As Integer
MinX = Xs(1).cX
MaxX = Xs(1).cX
MinY = Xs(1).cY
MaxY = Xs(1).cY
For i = 2 To 4
If MinX > Xs(i).cX Then MinX = Xs(i).cX
If MaxX < Xs(i).cX Then MaxX = Xs(i).cX
If MinY > Xs(i).cY Then MinY = Xs(i).cY
If MaxY < Xs(i).cY Then MaxY = Xs(i).cY
Next
For i = MinX To MaxX
For j = MinY To MaxY
If Total(i, j) Then
GetValue = False
Exit Function
End If
Next
Next
If nType = 0 Then 'Get Y Value
EmptyCount = 0 'Get MinY
OKCount = 0
For i = MinY - 1 To MinY - (nWid - 1) Step -1
For j = MinX To MaxX
If Total(j, i) = False Then OKCount = OKCount + 1
Next
If OKCount >= picPictureNow.Width And OKCount >= picPictureNow.Height Then
EmptyCount = EmptyCount + 1
OKCount = 0
Else
Exit For
End If
Next
MinY = MinY - EmptyCount
If MinY < 1 Then MinY = 1
EmptyCount = 0 'GetMaxY
OKCount = 0
For i = MaxY + 1 To MaxY + nWid - 1
For j = MinX To MaxX
If Total(j, i) = False Then OKCount = OKCount + 1
Next
If OKCount >= picPictureNow.Width And OKCount >= picPictureNow.Height Then
EmptyCount = EmptyCount + 1
OKCount = 0
Else
Exit For
End If
Next
MaxY = MaxY + EmptyCount
If MaxY > 20 Then MaxY = 20
Else 'Get X Value
EmptyCount = 0 'Get MinX
OKCount = 0
For i = MinX - 1 To MinX - (nWid - 1) Step -1
For j = MinY To MaxY
If Total(i, j) = False Then OKCount = OKCount + 1
Next
If OKCount >= picPictureNow.Width And OKCount >= picPictureNow.Height Then
EmptyCount = EmptyCount + 1
OKCount = 0
Else
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?