📄 frmdocument.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 frmdocument
Caption = "form1"
ClientHeight = 3195
ClientLeft = 5115
ClientTop = 3795
ClientWidth = 4680
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3195
ScaleWidth = 4680
Begin RichTextLib.RichTextBox text1
Height = 1335
Left = 120
TabIndex = 0
Top = 120
Width = 2655
_ExtentX = 4683
_ExtentY = 2355
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
TextRTF = $"frmdocument.frx":0000
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 360
Top = 2400
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "frmdocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub dk()
CommonDialog1.Filter = "rtf文件(*.rtf)|*.rtf" & "|文本文件(*.txt)*.txt"
CommonDialog1.FileName = ""
CommonDialog1.FilterIndex = 0
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
FileName = CommonDialog1.FileName
If CommonDialog1.FilterIndex = 1 Then
text1.LoadFile CommonDialog1.FileName, rtfRTF
Else
text1.LoadFile CommonDialog1.FileName, rtfText
End If
End Sub
Sub bc()
CommonDialog1.Filter = "rtf文件(*.rtf)|.rtf" & "|文本文件(*.txt)|*.txt"
CommonDialog1.FileName = FileName
CommonDialog1.ShowSave
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
If CommonDialog1.FilterIndex = 1 Then
text1.SaveFile CommonDialog1.FileName, rtfRTF
Else
text1.SaveFile CommonDialog1.FileName, rtfText
End If
End Sub
Sub diaoyong1()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont
If Err <> vbCancel Then
If CommonDialog1.FontName <> "" Then
text1.SelFontName = CommonDialog1.FontName
End If
text1.SelFontSize = CommonDialog1.FontSize
text1.SelBold = CommonDialog1.FontBold
text1.SelItalic = CommonDialog1.FontItalic
text1.SelUnderline = CommonDialog1.FontUnderline
text1.SelStrikeThru = CommonDialog1.FontStrikethru
End If
End Sub
Private Sub Form_Resize()
text1.Height = ScaleHeight - 500
text1.Width = ScaleWidth - 500
End Sub
Sub diaoyong2()
On Error GoTo errstr
CommonDialog1.CancelError = True
CommonDialog1.Flags = cdlCFBoth
If text1.SelColor Then
CommonDialog1.color = text1.SelColor
Else
CommonDialog1.color = 0
End If
CommonDialog1.ShowColor
text1.SelColor = CommonDialog1.color
errstr:
End Sub
Public Sub Text1_Change()
MDIForm1.textchanged = True
End Sub
Private Sub text1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
MDIForm1.PopupMenu MDIForm1.mnupopedit
End If
If text1.SelText <> "" Then
MDIForm1.Toolbar1.Buttons(5).Enabled = True
MDIForm1.Toolbar1.Buttons(6).Enabled = True
MDIForm1.mnupopeditcut = True
MDIForm1.mnupopeditcopy = True
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft, vbKeyRight, vbKeyUp, vbKeyDown
KeyCode = 0
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -