📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 7770
ClientLeft = 165
ClientTop = 855
ClientWidth = 9075
LinkTopic = "Form1"
ScaleHeight = 7770
ScaleWidth = 9075
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmddel
Caption = "去掉空格后的文字"
Height = 615
Left = 3480
TabIndex = 2
Top = 6840
Width = 2175
End
Begin RichTextLib.RichTextBox MainTxtBox2
Height = 6615
Left = 4680
TabIndex = 1
Top = 0
Width = 4335
_ExtentX = 7646
_ExtentY = 11668
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":0000
End
Begin RichTextLib.RichTextBox MainTxtBox
Height = 6615
Left = 0
TabIndex = 0
Top = 0
Width = 4455
_ExtentX = 7858
_ExtentY = 11668
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":009D
End
Begin MSComDlg.CommonDialog ComDlg
Left = 8400
Top = 6720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Menu mmufile
Caption = "文件"
Begin VB.Menu mmuopen
Caption = "打开"
End
Begin VB.Menu mmuSave
Caption = "保存"
End
Begin VB.Menu mmuExit
Caption = "退出"
End
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 Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_CANUNDO = &HC6
Private Const EM_UNDO = &HC7
Private Sub Command1_Click()
Dim str1 As String
Dim strArray() As String
Dim str2 As String
Dim i As Integer
Dim cdLen As Long
str1 = MainTxtBox.Text
strArray = Split(str1, "(")
For i = 0 To UBound(strArray)
If i = 0 Then
str2 = str2 + strArray(0)
Else
cdLen = InStr(1, strArray(i), ")")
str2 = str2 & Mid(strArray(i), cdLen + 1, Len(strArray(i)) - cdLen)
End If
Next
MainTxtBox2.Text = str2
End Sub
Private Sub mmuCancel_Click()
Dim c As Integer
c = SendMessage(MainTxtBox.hwnd, EM_UNDO, 0, 0)
End Sub
Private Sub cmddel_Click()
Dim d() As String, i&
d = Split(MainTxtBox.Text, vbCrLf)
MainTxtBox.Text = ""
For i = 0 To UBound(d)
d(i) = Left(d(i), InStr(1, d(i), " "))
MainTxtBox2.Text = MainTxtBox2.Text & d(i) & vbCrLf
Next
End Sub
Private Sub mmuExit_Click()
End
End Sub
Private Sub mmuOpen_Click()
On Error GoTo non
ComDlg.Filter = "Text files(*.txt)|*.txt|HTML Files (*.html)|*.html|All Files (*.*)|*.*"
ComDlg.ShowOpen
MainTxtBox.LoadFile ComDlg.FileName, rtfText
non:
End Sub
Private Sub mmuSave_Click()
ComDlg.ShowSave
MainTxtBox2.SaveFile ComDlg.FileName, rtfText
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -