【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了frmForm.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form frmForm
BorderStyle = 3 'Fixed Dialog
Caption = "俄罗斯方块游戏"
ClientHeight = 6345
ClientLeft = 1275
ClientTop = 705
ClientWidth = 4950
Icon = "frmForm.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 6345
ScaleWidth = 4950
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame fraFrameNext
Caption = "下一块"
Height = 2175
Left = 120
TabIndex = 3
Top = 120
Width = 1335
Begin VB.CommandButton cmdDisplay
Caption = "隐藏(&D)"
Height = 255
Left = 120
TabIndex = 5
TabStop = 0 'False
Top = 1800
Width = 1095
End
Begin VB.PictureBox picPictureNextBackGround
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1335
Left = 120
ScaleHeight = 1275
ScaleWidth = 1050
TabIndex = 4
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 = 800
Left = 480
Top = 4800
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 = 120
Width = 3030
Begin VB.PictureBox picPictureTemp
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00404040&
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
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
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
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.Image imgPictureNowBackup
Height = 375
Left = 960
Top = 4800
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