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

📄 savedlg.frm

📁 吃豆子游戏的源代码。 嘿嘿
💻 FRM
字号:
VERSION 5.00
Begin VB.Form SaveDlg 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Save Pacman Level"
   ClientHeight    =   3060
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   3525
   Icon            =   "SaveDlg.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3060
   ScaleWidth      =   3525
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton DelLev 
      Caption         =   "Erase Level"
      Height          =   330
      Left            =   1215
      TabIndex        =   21
      Top             =   2655
      Width           =   1185
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 1"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   1
      Left            =   90
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   10
      Top             =   90
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 2"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   2
      Left            =   1260
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   90
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 3"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   3
      Left            =   2430
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   90
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 4"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   4
      Left            =   90
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   945
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 5"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   5
      Left            =   1260
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   945
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 6"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   6
      Left            =   2430
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   945
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 7"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   7
      Left            =   90
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1800
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 8"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   8
      Left            =   1260
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1800
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.OptionButton Level 
      Caption         =   "Level 9"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Index           =   9
      Left            =   2430
      MaskColor       =   &H00400040&
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1800
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.CommandButton Cancel 
      Caption         =   "Cancel"
      Height          =   330
      Left            =   2475
      MaskColor       =   &H00FF00FF&
      TabIndex        =   1
      Top             =   2655
      UseMaskColor    =   -1  'True
      Width           =   1005
   End
   Begin VB.CommandButton Ok 
      Caption         =   "Save Level"
      Default         =   -1  'True
      Height          =   330
      Left            =   45
      TabIndex        =   0
      Top             =   2655
      Width           =   1095
   End
   Begin VB.FileListBox FileList 
      Height          =   2820
      Left            =   3150
      Pattern         =   "*.PML"
      TabIndex        =   19
      Top             =   45
      Visible         =   0   'False
      Width           =   1635
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   9
      Left            =   2430
      TabIndex        =   20
      Top             =   2250
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   8
      Left            =   1260
      TabIndex        =   18
      Top             =   2250
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   5
      Left            =   1260
      TabIndex        =   15
      Top             =   1395
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H0000FF00&
      Caption         =   "Free"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   2
      Left            =   1260
      TabIndex        =   12
      Top             =   540
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   7
      Left            =   90
      TabIndex        =   17
      Top             =   2250
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   6
      Left            =   2430
      TabIndex        =   16
      Top             =   1395
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   4
      Left            =   90
      TabIndex        =   14
      Top             =   1395
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   3
      Left            =   2430
      TabIndex        =   13
      Top             =   540
      Width           =   1000
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   1
      Left            =   90
      TabIndex        =   11
      Top             =   540
      Width           =   1000
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000014&
      Index           =   1
      X1              =   -300
      X2              =   4515
      Y1              =   2565
      Y2              =   2565
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000010&
      Index           =   0
      X1              =   -315
      X2              =   5785
      Y1              =   2580
      Y2              =   2580
   End
End
Attribute VB_Name = "SaveDlg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CharsSoFar As Integer '\--used when saving the level
Dim LineString As String  '/-^
Private Sub Form_Load()
 Me.Icon = nForm.Icon
 UpdateStats 'update used / free info
End Sub
Private Sub UpdateStats() 'update the used/free info
 Dim I As Integer
 For I = 1 To 9 'go through each level
  If LevExists(I, Me.FileList) = True Then   'the level exsists
   LevelStat(I).Caption = "Used"
   LevelStat(I).BackColor = vbRed
   LevelStat(I).Tag = "1"
  Else 'the level doesn't exsists
   LevelStat(I).Caption = "Free"
   LevelStat(I).BackColor = vbGreen
   LevelStat(I).Tag = "0"
  End If
  'Level(I).Value = False
 Next I
End Sub
Private Sub Level_Click(Index As Integer)
 'warn about overwriting
 If LevelStat(Index).Tag = "1" Then MsgBox "If You Continue You Will Erase The Previous Level!", vbCritical, "Continue?"
End Sub
Private Sub Ok_Click()
 Dim File As String 'the file to save to
 For I = 1 To 9 'go through each level option
  If Level(I).Value = True Then 'that level has been selected
   File = "Level" & I & ".PML" 'the file nam eof the level
   SaveIT File 'save the file
   Unload Me: Exit Sub
  End If
 Next I
'Unload Me
End Sub
Private Sub Cancel_Click()
 Unload Me
End Sub
Public Sub SaveIT(File As String)
 With nForm
  ThisDir "Levels" 'goto to the correct directory
  Close #1 '\--make sure all files are closed
  Close #2 '/-^
  Open File For Output As #1 'open the level for output
  Print #1, .LevelScheme 'write the scheme to the file
  For I = 0 To (.Grid.Count - 1) 'go through each grid square
   CharsSoFar = CharsSoFar + 1 ' count the number of characters placed down (the object)
   LineString = LineString & .Grid(I).Tag ' add the object the string
   If CharsSoFar = 19 Then ' the 19th object has been reached
    Print #1, LineString   ' so write the info to the file
    LineString = "" 'reset the objects for the next line
    CharsSoFar = 0 'reset the objects counted
   End If
  Next I
  Close #1 'close  the file
 End With
End Sub
'delete the selected level
Private Sub DelLev_Click()
 Dim MessageBoxResults As VbMsgBoxResult
 For I = 1 To 9 'go through each level option
  If Level(I).Value = True Then ' see if it has been selected
    'warn about erasing level
    MessageBoxResults = MsgBox("Are You Sure You Want To Delete Level " & I & " ?", vbYesNo, "Erase Level")
    If MessageBoxResults = vbYes Then 'the user clicked "YES"
     ThisDir "levels" 'place the current dir into the correct one
     Kill "level" & Trim(Str(I)) & ".pml" 'delete the level
     UpdateStats 'update the used/free info
     Me.Refresh
    End If
   End If
  Next I
UpdateStats 'update the used/free info
Me.Refresh
End Sub

⌨️ 快捷键说明

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