repfrm.frm

来自「吃豆子游戏的源代码。 嘿嘿」· FRM 代码 · 共 361 行

FRM
361
字号
VERSION 5.00
Begin VB.Form RepFrm 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Replace Map Object"
   ClientHeight    =   2160
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   4380
   Icon            =   "RepFrm.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2160
   ScaleWidth      =   4380
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Caption         =   "Replace"
      Height          =   735
      Left            =   45
      TabIndex        =   13
      Top             =   90
      Width           =   4290
      Begin VB.OptionButton PacMan 
         Height          =   400
         Index           =   0
         Left            =   3735
         MaskColor       =   &H00000000&
         Style           =   1  'Graphical
         TabIndex        =   21
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Floor 
         BackColor       =   &H000080FF&
         Height          =   400
         Index           =   0
         Left            =   90
         Style           =   1  'Graphical
         TabIndex        =   23
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Food 
         Height          =   400
         Index           =   0
         Left            =   3330
         MaskColor       =   &H00FFFF00&
         Style           =   1  'Graphical
         TabIndex        =   22
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Shield 
         Height          =   400
         Index           =   0
         Left            =   1710
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   20
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Ghoul 
         Height          =   400
         Index           =   0
         Left            =   2115
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   19
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Life 
         Height          =   400
         Index           =   0
         Left            =   2520
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   18
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Beer 
         Height          =   400
         Index           =   0
         Left            =   2925
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   17
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Cherry 
         Height          =   400
         Index           =   0
         Left            =   1305
         Style           =   1  'Graphical
         TabIndex        =   16
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Berry 
         Height          =   400
         Index           =   0
         Left            =   900
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   15
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Wall 
         Height          =   400
         Index           =   0
         Left            =   495
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   225
         UseMaskColor    =   -1  'True
         Value           =   -1  'True
         Width           =   400
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "With"
      Height          =   735
      Left            =   45
      TabIndex        =   2
      Top             =   855
      Width           =   4290
      Begin VB.OptionButton Floor 
         BackColor       =   &H002482FF&
         Height          =   400
         Index           =   1
         Left            =   90
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Food 
         Height          =   400
         Index           =   1
         Left            =   3330
         MaskColor       =   &H00FFFF00&
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton PacMan 
         Height          =   400
         Index           =   1
         Left            =   3735
         MaskColor       =   &H00000000&
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Shield 
         Height          =   400
         Index           =   1
         Left            =   1710
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Ghoul 
         Height          =   400
         Index           =   1
         Left            =   2115
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Life 
         Height          =   400
         Index           =   1
         Left            =   2520
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Beer 
         Height          =   400
         Index           =   1
         Left            =   2925
         MaskColor       =   &H00FF00FF&
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Cherry 
         Height          =   400
         Index           =   1
         Left            =   1305
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Berry 
         Height          =   400
         Index           =   1
         Left            =   900
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   225
         UseMaskColor    =   -1  'True
         Width           =   400
      End
      Begin VB.OptionButton Wall 
         Height          =   400
         Index           =   1
         Left            =   495
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   225
         UseMaskColor    =   -1  'True
         Value           =   -1  'True
         Width           =   400
      End
   End
   Begin VB.CommandButton Cancel 
      Caption         =   "Cancel"
      Height          =   330
      Left            =   2385
      MaskColor       =   &H00FF00FF&
      Picture         =   "RepFrm.frx":000C
      TabIndex        =   1
      Top             =   1755
      UseMaskColor    =   -1  'True
      Width           =   1680
   End
   Begin VB.CommandButton Ok 
      Caption         =   "OK"
      Height          =   330
      Left            =   270
      TabIndex        =   0
      Top             =   1755
      Width           =   1680
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000014&
      Index           =   1
      X1              =   -90
      X2              =   4725
      Y1              =   1665
      Y2              =   1665
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000010&
      Index           =   0
      X1              =   -105
      X2              =   5995
      Y1              =   1675
      Y2              =   1675
   End
End
Attribute VB_Name = "RepFrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cancel_Click()
Unload Me
End Sub

Private Sub Form_Load()
 Me.Icon = nForm.Icon
 LoadTheseImages 'load the current images of the objects
End Sub

Private Sub Ok_Click()
Dim StartObj As Integer 'the object to replace
Dim EndObj As Integer   'the object it is being replaced with
 
 StartObj = 99 '\-- set values to 99 , if any value is still
 EndObj = 99   '/-- 99, then nothing has been selected
 
 'see which object is being replaced
 If Berry(0).Value = True Then StartObj = 9
 If Shield(0).Value = True Then StartObj = 8
 If Life(0).Value = True Then StartObj = 7
 If Cherry(0).Value = True Then StartObj = 6
 If Beer(0).Value = True Then StartObj = 5
 If Ghoul(0).Value = True Then StartObj = 4
 If Food(0).Value = True Then StartObj = 3
 If PacMan(0).Value = True Then StartObj = 2
 If Wall(0).Value = True Then StartObj = 1
 If Floor(0).Value = True Then StartObj = 0
 
 'see what it is being replaced with
 If Berry(1).Value = True Then EndObj = 9
 If Shield(1).Value = True Then EndObj = 8
 If Life(1).Value = True Then EndObj = 7
 If Cherry(1).Value = True Then EndObj = 6
 If Beer(1).Value = True Then EndObj = 5
 If Ghoul(1).Value = True Then EndObj = 4
 If Food(1).Value = True Then EndObj = 3
 If PacMan(1).Value = True Then EndObj = 2
 If Wall(1).Value = True Then EndObj = 1
 If Floor(1).Value = True Then EndObj = 0
 
 'make sure both things were selected, if not stop here
 If StartObj = 99 Or EndObj = 99 Then MsgBox "There Was An Error, Nothing Has Been Replaced.", vbCritical, "Error": Exit Sub
  
 Dim I As Integer
 With nForm
  .SetAllToFalse 'set all selected object values to false
  For I = 0 To .Grid.Count - 1 'go through each sqaure on the grid
   'replace the object if it the the one that is being replaced
   If .Grid(I).Tag = StartObj Then .LoadObject I, EndObj
  Next I
 End With
Unload Me
End Sub
'load the pictures into the form
Public Sub LoadTheseImages()
With nForm
 For I = 0 To 1
  Wall(I).Picture = .NewWall.Picture
  Berry(I).Picture = .NewBerry.Picture
  Cherry(I).Picture = .NewCherry.Picture
  Shield(I).Picture = .NewShield.Picture
  Ghoul(I).Picture = .NewGhoul.Picture
  Life(I).Picture = .NewLife.Picture
  Beer(I).Picture = .NewBeer.Picture
  Food(I).Picture = .NewFood.Picture
  PacMan(I).Picture = .PacMan.Picture
 Next I
End With
End Sub

⌨️ 快捷键说明

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