file.frm

来自「VB6程序设计参考手册 -独立源码 VB6程序设计参考手册 -独立源码」· FRM 代码 · 共 90 行

FRM
90
字号
VERSION 5.00
Begin VB.Form myform 
   Caption         =   "打开"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Cmd2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3360
      TabIndex        =   4
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton Cmd1 
      Caption         =   "确定"
      Height          =   375
      Left            =   3360
      TabIndex        =   3
      Top             =   2160
      Width           =   1215
   End
   Begin VB.FileListBox File1 
      Height          =   1350
      Left            =   240
      Pattern         =   "*.jpg;*.bmp;*.gif"
      TabIndex        =   2
      Top             =   1680
      Width           =   2780
   End
   Begin VB.DirListBox Dir1 
      Height          =   1140
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   2775
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   2775
   End
End
Attribute VB_Name = "myform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public filename
Dim sfilename

'   当驱动器改变时,相应的目录列表路径要改变
Private Sub Drive1_change()
    Dir1.Path = Drive1.Drive
End Sub

'   当目录改变时,相应的文件列表路径要改变
Private Sub Dir1_change()
    File1.Path = Dir1.Path
    
End Sub

'   确定要打开时,则将该文件名传给其他程序
Private Sub Cmd1_click()
    If Right(File1.Path, 1) <> "\" Then
        sfilename = File1.Path + "\" + File1.filename
    Else
        sfilename = File1.Path + File1.filename
    End If
    filename = sfilename
    '  隐藏对话框
    Unload Me
End Sub

Private Sub Cmd2_click()
    '  取消退出
    End
End Sub
'

⌨️ 快捷键说明

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