📄
字号:
VERSION 5.00
Begin VB.Form frmFile
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "提供路径和文件名"
ClientHeight = 6120
ClientLeft = 60
ClientTop = 345
ClientWidth = 6960
LinkTopic = "Form1"
ScaleHeight = 6120
ScaleWidth = 6960
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "退 出"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 13
ToolTipText = "停止作业,结束程序运行"
Top = 5640
Width = 1575
End
Begin VB.CommandButton cmdOK
Caption = "确 定"
Default = -1 'True
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
TabIndex = 12
ToolTipText = "给出文件名后单击"
Top = 5640
Width = 1575
End
Begin VB.TextBox txtFile
Alignment = 2 'Center
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 11
Top = 5160
Width = 6495
End
Begin VB.TextBox txtNew
Alignment = 2 'Center
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 9
Top = 4200
Width = 2535
End
Begin VB.OptionButton Option2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "用新文件名"
ForeColor = &H80000008&
Height = 375
Left = 120
TabIndex = 7
Top = 1440
Width = 1695
End
Begin VB.OptionButton Option1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "用旧文件名(旧文件将被破坏)"
ForeColor = &H80000008&
Height = 495
Left = 120
TabIndex = 6
Top = 960
Value = -1 'True
Width = 2895
End
Begin VB.FileListBox File1
Appearance = 0 'Flat
Height = 2010
Left = 240
TabIndex = 2
Top = 2400
Width = 2535
End
Begin VB.DirListBox Dir1
Appearance = 0 'Flat
Height = 3030
Left = 3240
TabIndex = 1
Top = 600
Width = 3495
End
Begin VB.DriveListBox Drive1
Appearance = 0 'Flat
Height = 300
Left = 120
TabIndex = 0
Top = 600
Width = 3015
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "数据文件全名"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Left = 1800
TabIndex = 10
Top = 4800
Width = 3375
End
Begin VB.Label Label4
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "新文件名(不带扩展名)"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Left = 3120
TabIndex = 8
Top = 3840
Width = 3735
End
Begin VB.Label Label3
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "选择数据文件"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Left = 120
TabIndex = 5
Top = 1920
Width = 2775
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "选择目录"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Left = 3360
TabIndex = 4
Top = 120
Width = 3135
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "选择驱动器"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 495
Left = 360
TabIndex = 3
Top = 120
Width = 2415
End
End
Attribute VB_Name = "frmFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'文件窗体
'利用文件控件提供路径和文件名
'设定为启动模块
Option Explicit
Private Sub Form_Load()
Label4.Visible = False '暂不显示新建文件指示标签
txtNew.Visible = False '暂不显示容纳新建文件名的文本框
File1.Pattern = "*.dat" '文件列表框只显示数据文件
'缺省设置的文件全名,与应用程序在同一个子目录内
txtFile.Text = App.Path & "\" & "New_Data.dat"
End Sub
'选择目录
Private Sub Dir1_Change()
File1.Path = Dir1.Path
txtFile.Text = Dir1.Path & "\" & txtNew.Text & ".dat"
End Sub
'选择驱动器
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
txtFile.Text = Dir1.Path & "\" & txtNew.Text & ".dat"
End Sub
'确定文件
Private Sub File1_Click()
txtFile.Text = Dir1.Path & "\" & File1.FileName
End Sub
'选择打开文件
Private Sub Option1_Click()
Label3.Visible = True '显示打开文件指示标签
File1.Visible = True '显示文件控件
Label4.Visible = False '不显示新建文件指示标签
txtNew.Visible = False '不显示容纳新建文件名的文本框
End Sub
'选择新建文件
Private Sub Option2_Click()
Label3.Visible = False '不显示打开文件指示标签
File1.Visible = False '不显示文件控件
Label4.Visible = True '显示新建文件指示标签
txtNew.Visible = True '显示容纳新建文件名的文本框
txtNew.SetFocus '取得焦点
End Sub
'新建文件全名
Private Sub txtNew_Change()
txtFile.Text = Dir1.Path & "\" & txtNew.Text & ".dat"
End Sub
'确定,给出文件名后单击
Private Sub cmdOK_Click()
strFileName = txtFile.Text '文件名
Unload Me
'显示提供行数和列数窗体
frmRoCo.Visible = True
End Sub
'退出,结束程序运行
Private Sub cmdExit_Click()
Unload Me
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -