opendlg.frm

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

FRM
446
字号
VERSION 5.00
Begin VB.Form OpenDlg 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Open Level For Edit"
   ClientHeight    =   3405
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   3525
   Icon            =   "OpenDlg.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3405
   ScaleWidth      =   3525
   ShowInTaskbar   =   0   'False
   Begin VB.CheckBox OpenInNew 
      Caption         =   "Open Level In New Window?"
      Height          =   285
      Left            =   90
      TabIndex        =   22
      Top             =   2565
      Width           =   2670
   End
   Begin VB.CommandButton DelLev 
      Caption         =   "Erase Level"
      Height          =   330
      Left            =   1215
      TabIndex        =   21
      Top             =   3015
      Width           =   1140
   End
   Begin VB.FileListBox FileList 
      Height          =   2820
      Left            =   3105
      Pattern         =   "*.PML"
      TabIndex        =   11
      Top             =   180
      Visible         =   0   'False
      Width           =   1635
   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        =   10
      Top             =   1845
      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        =   9
      Top             =   1845
      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        =   8
      Top             =   1845
      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        =   7
      Top             =   990
      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             =   990
      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        =   5
      Top             =   990
      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        =   4
      Top             =   135
      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        =   3
      Top             =   135
      UseMaskColor    =   -1  'True
      Width           =   1000
   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        =   2
      Top             =   135
      UseMaskColor    =   -1  'True
      Width           =   1000
   End
   Begin VB.CommandButton Ok 
      Caption         =   "Open Level"
      Default         =   -1  'True
      Height          =   330
      Left            =   0
      TabIndex        =   1
      Top             =   3015
      Width           =   1185
   End
   Begin VB.CommandButton Cancel 
      Caption         =   "Cancel"
      Height          =   330
      Left            =   2385
      MaskColor       =   &H00FF00FF&
      TabIndex        =   0
      Top             =   3015
      UseMaskColor    =   -1  'True
      Width           =   1050
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   1
      Left            =   90
      TabIndex        =   20
      Top             =   585
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   3
      Left            =   2430
      TabIndex        =   19
      Top             =   585
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   4
      Left            =   90
      TabIndex        =   18
      Top             =   1440
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   6
      Left            =   2430
      TabIndex        =   17
      Top             =   1440
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   7
      Left            =   90
      TabIndex        =   16
      Top             =   2295
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H0000FF00&
      Caption         =   "Free"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   2
      Left            =   1260
      TabIndex        =   15
      Top             =   585
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   5
      Left            =   1260
      TabIndex        =   14
      Top             =   1440
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   8
      Left            =   1260
      TabIndex        =   13
      Top             =   2295
      Width           =   1005
   End
   Begin VB.Label LevelStat 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      Caption         =   "Used"
      ForeColor       =   &H00000000&
      Height          =   195
      Index           =   9
      Left            =   2430
      TabIndex        =   12
      Top             =   2295
      Width           =   1005
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000010&
      Index           =   0
      X1              =   -360
      X2              =   5740
      Y1              =   2940
      Y2              =   2940
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000014&
      Index           =   1
      X1              =   -345
      X2              =   4470
      Y1              =   2925
      Y2              =   2925
   End
End
Attribute VB_Name = "OpenDlg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim I As Integer 'used in for...next loops
'Dim OpenLevel As String 'the level to open
Private Sub Cancel_Click()
 Unload Me
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
Private Sub Form_Load()
 'Me.Icon = FirstForm.Icon
' FirstForm.Visible = False 'make sure the first form is hidden
 OpenIsFinished = False 'say that the open process has not yet finished
 UpdateStats  'update the used/free info
End Sub
Private Sub UpdateStats() 'update the used/free info
 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 = "0"
   Level(I).Enabled = True
  Else 'the level doesn't exsists
   LevelStat(I).Caption = "Free"
   LevelStat(I).BackColor = vbGreen
   LevelStat(I).Tag = "1"
   Level(I).Enabled = False
  End If
  Level(I).Value = False
 Next I
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 OpenIsFinished = True 'the open process has finished
End Sub
Private Sub Ok_Click()
 If MDIFrm.ToolBar.Enabled = False Then OpenInNew.Value = 1 ' open in a new window if there is no active one.
 For I = 1 To 9 'go through each level
  If Level(I).Value = True Then 'the level has been selected
   If OpenInNew.Value = 1 Then 'see if the user want to open it in a new window
    NumFrms = NumFrms + 1              '\
    Set nEdit(NumFrms) = New EditFrm   ' |-- Load A New Window
    Load nEdit(NumFrms)                '/
    nEdit(NumFrms).LoadLevel_Map Trim("level" & Trim(Str(I)) & ".pml") 'open the level in the new window
   Else 'the user wants to open the level in the active window
    nForm.LoadLevel_Map Trim("level" & Trim(Str(I)) & ".pml") 'open the level
   End If
  End If
 Next I
MDIFrm.ToolBar.Enabled = True
MDIFrm.IsDis.FillStyle = 4
Unload Me
End Sub

⌨️ 快捷键说明

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