?? frmform.frm
字號:
VERSION 5.00
Begin VB.Form frmForm
BorderStyle = 3 'Fixed Dialog
Caption = "俄羅斯方塊"
ClientHeight = 7170
ClientLeft = 1275
ClientTop = 705
ClientWidth = 6720
Icon = "frmForm.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 7170
ScaleWidth = 6720
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.HScrollBar HScroll1
Height = 495
LargeChange = 200
Left = 4200
Max = 500
Min = 100
SmallChange = 50
TabIndex = 9
Top = 4680
Value = 500
Width = 2295
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 4440
TabIndex = 8
Top = 5880
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "停止"
Height = 615
Left = 5520
TabIndex = 7
Top = 3360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "開始"
Height = 615
Left = 4200
TabIndex = 6
Top = 3360
Width = 975
End
Begin VB.Frame fraFrameNext
Caption = "下一塊"
Height = 2175
Left = 4560
TabIndex = 3
Top = 600
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&
Height = 1335
Left = 120
ScaleHeight = 1275
ScaleWidth = 1050
TabIndex = 4
TabStop = 0 'False
Top = 240
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 = 5040
Top = 5280
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 = 720
ScaleHeight = 20
ScaleMode = 0 'User
ScaleWidth = 10
TabIndex = 0
Top = 600
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 Label1
Caption = "速度:"
Height = 255
Left = 4560
TabIndex = 10
Top = 4320
Width = 1695
End
Begin VB.Image imgPictureNowBackup
Height = 375
Left = 5520
Top = 5280
Visible = 0 'False
Width = 495
End
Begin VB.Menu mnuGame
Caption = "游戲(&G)"
Begin VB.Menu mnuGameNew
Caption = "新游戲(&N)"
End
Begin VB.Menu Stop
Caption = "停止(&S)"
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)
Call 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
Exit For
End If
Next
MinX = MinX - EmptyCount
If MinX < 1 Then MinX = 1
EmptyCount = 0 'GetMaxX
OKCount = 0
For i = MaxX + 1 To MaxX + (nWid - 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
Exit For
End If
Next
MaxX = MaxX + EmptyCount
If MaxX > 10 Then MaxX = 10
End If
GetValue = True
End Function
Function Get_Y_Value()
If GetValue(0, 2) Then 'Get Y Value
If MaxY - MinY >= 2 Then
If MaxY - (picPictureNow.Top + 1) <= 1 Then
Adjust_Top = MinY - 1
Else
Adjust_Top = picPictureNow.Top
End If
Get_Y_Value = True
Exit Function
End If
End If
Get_Y_Value = False
End Function
Sub Global_Init()
'全局初始化
picBackGround.Cls
imgPictureNext.Picture = LoadPicture("")
picPictureNow.Visible = False
tmrDrop.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Call HScroll1_Change
tmrDrop.Interval = HScroll1.Value
Label1.Caption = "速度: " + Str(600 - HScroll1.Value)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -