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

📄 frmmain.frm

📁 利用VB的图片框实现屏幕的滚动如可以用来创建一些动画图形等。其实对于上面的问题我们也可 以利用图片框来巧妙地解决。
💻 FRM
📖 第 1 页 / 共 3 页
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMain 
   BackColor       =   &H0000C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "坦克大战"
   ClientHeight    =   9600
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   12000
   Icon            =   "frmMain.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   640
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   800
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer tmrWon 
      Enabled         =   0   'False
      Interval        =   2000
      Left            =   10800
      Top             =   2280
   End
   Begin VB.CommandButton cmdStart 
      Caption         =   "开始游戏"
      Height          =   495
      Left            =   9840
      TabIndex        =   1
      Top             =   8520
      Width           =   1935
   End
   Begin VB.Timer tmrMain 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   10200
      Top             =   2280
   End
   Begin MSComctlLib.ProgressBar prgRate 
      Height          =   495
      Left            =   10560
      TabIndex        =   8
      Top             =   6960
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   873
      _Version        =   393216
      BorderStyle     =   1
      Appearance      =   0
      Scrolling       =   1
   End
   Begin MSComctlLib.ProgressBar prgShield 
      Height          =   495
      Left            =   10560
      TabIndex        =   6
      Top             =   5520
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   873
      _Version        =   393216
      BorderStyle     =   1
      Appearance      =   0
      Scrolling       =   1
   End
   Begin MSComctlLib.ProgressBar prgSpeed 
      Height          =   495
      Left            =   10560
      TabIndex        =   7
      Top             =   6240
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   873
      _Version        =   393216
      BorderStyle     =   1
      Appearance      =   0
      Scrolling       =   1
   End
   Begin MSComctlLib.ProgressBar prgPower 
      Height          =   495
      Left            =   10560
      TabIndex        =   5
      Top             =   4800
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   873
      _Version        =   393216
      BorderStyle     =   1
      Appearance      =   0
      Scrolling       =   1
   End
   Begin MSComctlLib.ProgressBar prgStrength 
      Height          =   495
      Left            =   9840
      TabIndex        =   4
      Top             =   3840
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   873
      _Version        =   393216
      BorderStyle     =   1
      Appearance      =   0
      Scrolling       =   1
   End
   Begin VB.PictureBox picData 
      AutoRedraw      =   -1  'True
      BorderStyle     =   0  'None
      Height          =   1920
      Left            =   0
      Picture         =   "frmMain.frx":57E2
      ScaleHeight     =   1920
      ScaleWidth      =   8160
      TabIndex        =   2
      Top             =   0
      Visible         =   0   'False
      Width           =   8160
   End
   Begin VB.PictureBox picMain 
      AutoRedraw      =   -1  'True
      BorderStyle     =   0  'None
      Height          =   9600
      Left            =   0
      ScaleHeight     =   640
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   640
      TabIndex        =   0
      Top             =   0
      Width           =   9600
      Begin VB.Shape shpEditor 
         BorderColor     =   &H000000FF&
         BorderStyle     =   6  'Inside Solid
         Height          =   480
         Left            =   0
         Shape           =   4  'Rounded Rectangle
         Top             =   0
         Width           =   480
      End
   End
   Begin VB.PictureBox picBack 
      AutoRedraw      =   -1  'True
      BorderStyle     =   0  'None
      Height          =   9600
      Left            =   0
      ScaleHeight     =   9600
      ScaleWidth      =   9600
      TabIndex        =   3
      Top             =   0
      Visible         =   0   'False
      Width           =   9600
   End
   Begin VB.Label lbla 
      AutoSize        =   -1  'True
      BackColor       =   &H0000FFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "地图编辑状态!"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   9840
      TabIndex        =   16
      Top             =   8040
      Width           =   1905
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "电脑援军数量"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   240
      Left            =   9840
      TabIndex        =   15
      Top             =   840
      Width           =   1530
   End
   Begin VB.Label lblEnemyCount 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Label6"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   9840
      TabIndex        =   14
      Top             =   1200
      Width           =   1935
   End
   Begin VB.Label lblTankCount 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Label6"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   240
      Left            =   9840
      TabIndex        =   13
      Top             =   3480
      Width           =   810
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "火力"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   9840
      TabIndex        =   12
      Top             =   7080
      Width           =   510
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "速度"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   9840
      TabIndex        =   11
      Top             =   6360
      Width           =   510
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "装甲"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   9840
      TabIndex        =   10
      Top             =   5640
      Width           =   510
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "威力"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   9840
      TabIndex        =   9
      Top             =   4920
      Width           =   510
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' ________________________________________________________________________________
'
' API函数及相关声明
' ________________________________________________________________________________
'
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
    ByVal X As Long, ByVal Y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, _
    ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long

Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As typKBBytes) As Long
Private Const VK_RETURN = &HD
Private Const VK_SPACE = &H20
Private Const VK_UP = &H26
Private Const VK_DOWN = &H28
Private Const VK_LEFT = &H25
Private Const VK_RIGHT = &H27
Private Const VK_ESCAPE = &H1B
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1

' ________________________________________________________________________________
'
' 常量及枚举声明
' ________________________________________________________________________________
'
Private Const EnemyMax As Long = 24
Private Const TankMax As Long = 2
Private Const ActiveMax As Long = 8
Private Const StrengthMax As Long = 6
Private Const LowPower As Long = 4
Private Const MidPower As Long = 5
Private Const HighPower As Long = 6
Private Const LowShield As Long = 0
Private Const MidShield As Long = 1
Private Const HighShield As Long = 2
Private Const LowSpeed As Long = 1
Private Const MidSpeed As Long = 2
Private Const HighSpeed As Long = 4
Private Const LowRate As Long = 1
Private Const MidRate As Long = 2
Private Const HighRate As Long = 3
Private Const SPTMax As Long = HighRate
Private Const FireStepMax As Long = 20
Private Const ShellSpeed As Long = 6
Private Const FirstShell As Long = 1000
Private Const ShellMax As Long = (ActiveMax + 1) * HighRate - 1
Private Const BlazeMax As Long = ShellMax
Private Const BlazeStep As Single = 0.2
Private Const BlazeStepMax As Long = 7
Private Const CellXMax As Long = 19
Private Const CellYMax As Long = 19
Private Const CellSize As Long = 32
Private Const HalfCellSize As Long = 16
Private Const PauseTimePlus As Long = 300
Private Const CellSizeX2 As Long = CellSize * 2
Private Const CellSizeX3 As Long = CellSize * 3
Private Const CellSizeX4 As Long = CellSize * 4
Private Const CellSizeXCellXMax As Long = CellSize * CellXMax
Private Const CellSizeXCellYMax As Long = CellSize * CellYMax

Enum enuCell
    CGround
    CArmor
    CBrick
    CClod
    CWater
    CBox
    CEmpty
    CRepair
    CFull
    CPower
    CShield
    CSpeed
    CRate
    CLife
    CLevel
    CBlock
    CStop
End Enum

Enum enuDir

⌨️ 快捷键说明

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