⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmform.frm

📁 一个俄罗斯方块的小游戏,是用VB做的,有完整的源代码
💻 FRM
📖 第 1 页 / 共 3 页
字号:
VERSION 5.00
Begin VB.Form frmForm 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "旋转俄罗斯 1.0 Demo -- 泰立软件工作室"
   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        =   6
         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        =   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        =   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.Label lblInfo 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "泰立软件工作室荣誉出品                    作者:尹强"
      ForeColor       =   &H00C00000&
      Height          =   855
      Left            =   120
      TabIndex        =   4
      Top             =   5280
      Width           =   1335
   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
                    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
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -