📄 editor.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form1
Appearance = 0 'Flat
Caption = "Editor with Common Dialog"
ClientHeight = 2445
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 5055
ForeColor = &H80000008&
LinkMode = 1 'Source
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 2445
ScaleWidth = 5055
Begin MSComDlg.CommonDialog OpenLog
Left = 360
Top = 2505
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.TextBox txtConInfo
Appearance = 0 'Flat
Height = 1500
Left = 255
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Top = 180
Width = 4590
End
Begin VB.CommandButton openTxtFile
Appearance = 0 'Flat
Caption = "打开"
Height = 345
Left = 2490
TabIndex = 1
Top = 1785
Width = 975
End
Begin VB.CommandButton saveTxtFile
Appearance = 0 'Flat
Caption = "保存"
Height = 360
Left = 3525
TabIndex = 2
Top = 1785
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub openTxtFile_Click()
Dim fhandle As Integer
Dim Fname As String
Dim TextFromFile As String, NextLine As String, CRLF As String
CRLF = Chr$(13) + Chr$(10)
OpenLog.DialogTitle = "打开TXT文本文件"
OpenLog.Filter = "text files (*.txt)|*.txt|All files (*.*)|*.*"
OpenLog.InitDir = "c:\"
OpenLog.Action = 1
Fname = OpenLog.FileName
If Fname = "" Then
Exit Sub
End If
fhandle = FreeFile
Open Fname For Input As fhandle
If LOF(fhandle) > 30000 Then
MsgBox "您选择的文件太大,不能为您服务。"
Else
Do Until EOF(fhandle)
Line Input #fhandle, NextLine
TextFromFile = TextFromFile + NextLine + CRLF
Loop
End If
txtConInfo.Text = TextFromFile
Close fhandle
End Sub
Private Sub saveTxtFile_Click()
Dim fhandle As Integer
Dim Fname As String
OpenLog.DialogTitle = "保存TXT文本文件"
fhandle = FreeFile
OpenLog.InitDir = "c:\"
OpenLog.Action = 2
Fname = OpenLog.FileName
If Fname = "" Then
Exit Sub
End If
Open Fname For Output As fhandle
Print #fhandle, txtConInfo.Text
Close fhandle
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -