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

📄 vbtris32.frm

📁 一个很好的VB程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmVBtris 
   BackColor       =   &H0000FF00&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "VBtris32"
   ClientHeight    =   4560
   ClientLeft      =   1095
   ClientTop       =   1770
   ClientWidth     =   4320
   FillStyle       =   0  'Solid
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   304
   ScaleMode       =   0  'User
   ScaleWidth      =   288
   Begin VB.PictureBox picBoard 
      Height          =   4380
      Left            =   120
      ScaleHeight     =   288
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   160
      TabIndex        =   2
      Top             =   120
      Width           =   2460
   End
   Begin VB.PictureBox picBoard2 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H00C0C0C0&
      FillColor       =   &H00C0C0C0&
      FillStyle       =   0  'Solid
      ForeColor       =   &H00C0C0C0&
      Height          =   4380
      Left            =   4680
      ScaleHeight     =   290
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   162
      TabIndex        =   1
      Top             =   120
      Width           =   2460
   End
   Begin VB.PictureBox picNext 
      Height          =   1020
      Left            =   2730
      ScaleHeight     =   960
      ScaleWidth      =   1440
      TabIndex        =   0
      Top             =   360
      Width           =   1500
   End
   Begin VB.Label lblLevel 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   420
      Left            =   2730
      TabIndex        =   4
      Top             =   3870
      Width           =   1500
   End
   Begin VB.Label lblLines 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   420
      Left            =   2730
      TabIndex        =   5
      Top             =   2910
      Width           =   1500
   End
   Begin VB.Label lblScore 
      Alignment       =   2  'Center
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   420
      Left            =   2730
      TabIndex        =   7
      Top             =   1950
      Width           =   1500
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "Next Piece:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2790
      TabIndex        =   9
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "Score:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2790
      TabIndex        =   8
      Top             =   1695
      Width           =   1635
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Level:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2790
      TabIndex        =   6
      Top             =   3615
      Width           =   1635
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "Lines:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2790
      TabIndex        =   3
      Top             =   2655
      Width           =   1635
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuNewGame 
         Caption         =   "&New Game"
         Shortcut        =   {F2}
      End
      Begin VB.Menu mnuPause 
         Caption         =   "&Pause"
         Enabled         =   0   'False
      End
      Begin VB.Menu mnuEndGame 
         Caption         =   "&End Game"
         Enabled         =   0   'False
      End
      Begin VB.Menu mnuBar1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuHighScore 
         Caption         =   "&High Scores"
         Shortcut        =   {F4}
      End
      Begin VB.Menu mnuOptions 
         Caption         =   "&Options..."
      End
      Begin VB.Menu mnuBar2 
         Caption         =   "-"
      End
      Begin VB.Menu mnuExit 
         Caption         =   "E&xit"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "&Help"
      NegotiatePosition=   3  'Right
      Begin VB.Menu mnuInstruct 
         Caption         =   "&Instructions"
         Shortcut        =   {F1}
      End
      Begin VB.Menu mnubar3 
         Caption         =   "-"
      End
      Begin VB.Menu mnuAbout 
         Caption         =   "&About"
      End
   End
End
Attribute VB_Name = "frmVBtris"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'-------------------------------------------------------
'This form contains the user interface of the game
'-------------------------------------------------------

Private Sub Form_Activate()
'-------------------------------------------------------
'Refresh the board
'-------------------------------------------------------
Dim Temp
Temp = BitBlt(Board.BoardDC, 0, 0, 160, 288, Board.B2DC, 1, 1, SRCCOPY)

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'-------------------------------------------------------
'Moves the pieces left or right, rotates them, or speeds
'there descent provided that a game is being played and
'that they haven't stopped moving down.  Also, pauses
'and unpauses the game
'-------------------------------------------------------
If Board.Game And NewPiece = False And PauseTheGame = False Then
    Select Case KeyCode
        Case vbKeyLeft
            MovePieceLeft 'Move the piece left
        Case vbKeyRight
            MovePieceRight 'Move the piece right
        Case vbKeyClear, vbKeyUp
            RotatePiece    'Rotate the piece
        Case vbKeyDown
            FallPiece = True 'Speed the descent
            'This records the Y position of the piece
            'when it starts its rapid descent for
            'score keeping purposes.  Each line it
            'falls after this is worth one point.
            If FallY = 0 Then FallY = Board.PieceY
        Case vbKeyP    'Pause the game
            PauseTheGame = True
    End Select
ElseIf Board.Game And PauseTheGame And KeyCode = vbKeyP Then
    PauseTheGame = False    'Unpause the game
End If


End Sub

Private Sub Form_Load()
'-------------------------------------------------------
'Retrieve a picture from frmPics to prevent delays
'during a game
'-------------------------------------------------------
picNext = frmPics.Next(1)
picNext = LoadPicture("")
'-------------------------------------------------------
'Run the procedures involved with moving the pieces
'so there won't be any delays when they are first
'called
'-------------------------------------------------------
Board.CurPiece = 5
Board.PieceX = 5
Board.PieceY = 5
MovePieceDown
MovePieceLeft
MovePieceRight
RotatePiece

'-------------------------------------------------------
'Load the high scores so they can be displayed before a
'game is played
'-------------------------------------------------------
GetScores

End Sub

Private Sub Form_Resize()
'-------------------------------------------------------
'Pause the game if the form is minimized and a game is
'in progress and set AutoRedraw to true on picBoard so
'the gameboard will still appear there when the form is
'restored.
'-------------------------------------------------------
If frmVBtris.WindowState = 0 And Board.Game Then
    PauseTheGame = True
End If


End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
'-------------------------------------------------------
'End the program
'-------------------------------------------------------
DoEvents
Dim Temp As Long

If PlaySounds Then
    If InStr(App.Path, " ") Then
        Temp = mciSendString("close " & Chr(34) & App.Path & "\" & MUSIC & Chr(34), 0&, 0, 0)
    Else
        Temp = mciSendString("close " & App.Path & "\" & MUSIC, 0&, 0, 0)
    End If
End If
End

End Sub

Private Sub mnuAbout_Click()
'-------------------------------------------------------
'Display the about form and pause the game if one is in
'progress
'-------------------------------------------------------
If Board.Game Then
    PauseTheGame = True
End If
frmAbout.Show 1

End Sub

Private Sub mnuEndGame_Click()
'-------------------------------------------------------
'End the current game
'-------------------------------------------------------
GameOver = True

End Sub

Private Sub mnuExit_Click()
On Error Resume Next
'-------------------------------------------------------
'Unload the form to call the Form_Unload procedure.
'Attempting to end any other way has resulted in many
'a fatal error in VB32.EXE
'-------------------------------------------------------
Unload Me


End Sub

Private Sub mnuHighScore_Click()
'-------------------------------------------------------
'Display the high scores
'-------------------------------------------------------
DisplayHighScores

End Sub

Private Sub mnuInstruct_Click()
'-------------------------------------------------------
'Display the instructions and pause the game if one is
'in progress
'-------------------------------------------------------
If Board.Game Then
    PauseTheGame = True
End If
frmInstruct.Show 1

End Sub

Private Sub mnuNewGame_Click()
'-------------------------------------------------------
'Disable the new game and high score menus while
'enabling the end game and pause menus.
'-------------------------------------------------------
mnuNewGame.Enabled = False
mnuEndGame.Enabled = True
mnuHighScore.Enabled = False
mnuPause.Enabled = True
'-------------------------------------------------------
'Start the game
'-------------------------------------------------------
NewGame

End Sub

Private Sub mnuOptions_Click()
'-------------------------------------------------------
'Display the options form, fills in the options
'accordingly, and pause the game if one is in progress
'-------------------------------------------------------
If Board.Game Then
    PauseTheGame = True
End If
frmOptions.txtStartingLevel = StartingLevel
If FillLines Then
    frmOptions.chkFillLines.Value = 1
Else
    frmOptions.chkFillLines.Value = 0
End If
If PlaySounds Then
    frmOptions.chkPlaySounds.Value = 1
Else
    frmOptions.chkPlaySounds.Value = 0
End If
If HideSplash Then
    frmOptions.chkSkipIntro.Value = 1
Else
    frmOptions.chkSkipIntro.Value = 0
End If
frmOptions.Show 1

End Sub

Private Sub mnuPause_Click()
'-------------------------------------------------------
'Pause or unpause the game
'-------------------------------------------------------
PauseTheGame = Not (PauseTheGame)

End Sub


⌨️ 快捷键说明

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