?? form1.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "文件操作"
ClientHeight = 5070
ClientLeft = 60
ClientTop = 345
ClientWidth = 6525
LinkTopic = "Form1"
ScaleHeight = 5070
ScaleWidth = 6525
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "保存文件"
Height = 495
Left = 4800
TabIndex = 2
Top = 1200
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "新建文件"
Height = 495
Left = 4800
TabIndex = 1
Top = 480
Width = 1455
End
Begin MSComDlg.CommonDialog cd1
Left = 5040
Top = 2400
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.TextBox Text1
Height = 4815
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "Form1.frx":0000
Top = 120
Width = 4455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim modi As Boolean '記錄文本框中的內容是否修改
Private Sub Command1_Click()
If modi Then
If MsgBox("數據已被修改還未保存,真的新建文件?", vbYesNo, "提示") = vbNo Then Exit Sub
End If
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If modi = True Then
Dim filename As String
Dim fso, f
cd1.DialogTitle = "保存文件"
cd1.ShowSave
filename = cd1.filename
Set fso = CreateObject("scripting.filesystemobject")
fso.CreateTextFile filename
Set f = fso.GetFile(filename)
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Write Text1.Text
ts.Close
modi = False
End If
End Sub
Private Sub Form_Load()
modi = False
End Sub
Private Sub Text1_Change()
modi = True
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -