📄 v6j09-01.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "驱动器、目录和文件列表框示例"
ClientHeight = 3075
ClientLeft = 60
ClientTop = 345
ClientWidth = 4665
LinkTopic = "Form1"
ScaleHeight = 3075
ScaleWidth = 4665
StartUpPosition = 3 'Windows Default
Begin VB.ComboBox cboType
Height = 300
Left = 360
Style = 2 'Dropdown List
TabIndex = 3
Top = 2640
Width = 1935
End
Begin VB.FileListBox filFile
Height = 2625
Left = 2400
TabIndex = 2
Top = 120
Width = 1695
End
Begin VB.DirListBox dirDirectory
Height = 1770
Left = 360
TabIndex = 1
Top = 720
Width = 1935
End
Begin VB.DriveListBox drvDrive
Height = 300
Left = 360
TabIndex = 0
Top = 120
Width = 1935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub drvDrive_Change()
dirDirectory.Path = drvDrive.Drive
End Sub
Private Sub dirDirectory_Change()
filFile.Path = dirDirectory.Path
End Sub
Private Sub cboType_Click()
Select Case cboType.Text
Case "所有文件(*.*)"
filFile.Pattern = "*.*"
Case "窗体文件(*.FRM)"
filFile.Pattern = "*.FRM"
Case "位图文件(*.BMP)"
filFile.Pattern = "*.BMP"
End Select
'filFile.Pattern = Mid(cboType.Text, 21)
End Sub
Private Sub filFile_DblClick()
If Right(filFile.Path, 1) = "\" Then ' 当前选定的目录是根目录
fname = filFile.Path + filFile.FileName
Else ' 当前选定的目录是子目录,子目录与文件名之间加"\"
fname = filFile.Path + "\" + filFile.FileName
End If
RetVal = Shell(fname, 1) ' Shell函数的功能是运行程序。
End Sub
Private Sub Form_Load()
Item = "所有文件(*.*)"
cboType.AddItem Item
Item = "窗体文件(*.FRM)"
cboType.AddItem Item
Item = "位图文件(*.BMP)"
cboType.AddItem Item
cboType.ListIndex = 0
'cboType.AddItem Item + Space(20 - Len(Item)) + "*.*"
'Item = "窗体文件(*.FRM)"
'cboType.AddItem Item + Space(20 - Len(Item)) + "*.FRM"
'Item = "位图文件(*.BMP)"
'cboType.AddItem Item + Space(20 - Len(Item)) + "*.BMP"
'cboType.ListIndex = 2
End Sub
Sub filFile_Click()
MsgBox filFile.FileName
End Sub
'Sub filFile_DblClick()
' ChDir (dirDirectory.Path)
' RetVal = Shell(filFile.filename, 1)
'End Sub
'Private Sub filFile_KeyDown(KeyCode As Integer, Shift As Integer)
'If KeyCode = vbKeyDelete Then
'ChDrive drvDrive.Drive ' 设置缺省驱动器
'ChDir filFile.Path ' 设置缺省目录
'Kill filFile.FileName
'filFile.Refresh
'End If
'End Sub
'Private Sub filFile_KeyPress(KeyAscii As Integer)
'Print Keyscii
'End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -