📄 frmmain.frm
字号:
Index = 3
Visible = 0 'False
End
Begin VB.Menu mnuFileBar5
Caption = "-"
Visible = 0 'False
End
Begin VB.Menu mnuFileExit
Caption = "退出(&X)"
End
End
Begin VB.Menu mnuEdit
Caption = "编辑(&E)"
Begin VB.Menu mnuEditBar0
Caption = "-"
End
Begin VB.Menu mnuEditCut
Caption = "剪切(&T)"
Shortcut = ^X
End
Begin VB.Menu mnuEditCopy
Caption = "复制(&C)"
Shortcut = ^C
End
Begin VB.Menu mnuEditPaste
Caption = "粘贴(&P)"
Shortcut = ^V
End
End
Begin VB.Menu mnuView
Caption = "视图(&V)"
Begin VB.Menu mnuViewToolbar
Caption = "工具栏(&T)"
Checked = -1 'True
End
Begin VB.Menu mnuViewStatusBar
Caption = "状态栏(&B)"
Checked = -1 'True
End
End
Begin VB.Menu mnutxt
Caption = "文字(&t)"
Begin VB.Menu mnutxtfont
Caption = "字体(&f)"
End
Begin VB.Menu mnutxtcolor
Caption = "颜色(&c)"
End
Begin VB.Menu mnutxtBar0
Caption = "-"
End
Begin VB.Menu mnutxtbold
Caption = "粗体(&b)"
End
Begin VB.Menu mnutxtitalic
Caption = "斜体(&i)"
End
Begin VB.Menu mnutxtunderline
Caption = "下划线(&u)"
End
Begin VB.Menu mnutxtBar1
Caption = "-"
End
Begin VB.Menu mnutxtc
Caption = "居中(&c)"
End
Begin VB.Menu mnutxtl
Caption = "左对齐(&l)"
End
Begin VB.Menu mnutxtr
Caption = "右对齐(&r)"
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpBar0
Caption = "-"
End
Begin VB.Menu mnuHelpAbout
Caption = "关于(&A) "
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
'close all sub forms
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next
If Me.WindowState <> vbMinimized Then
SaveSetting App.Title, "Settings", "MainLeft", Me.Left
SaveSetting App.Title, "Settings", "MainTop", Me.Top
SaveSetting App.Title, "Settings", "MainWidth", Me.Width
SaveSetting App.Title, "Settings", "MainHeight", Me.Height
End If
End Sub
Private Sub tbToolBar_ButtonClick(ByVal Button As MSComCtlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "新建"
'应做:添加 '新建' 按钮代码。
MsgBox "添加 '新建' 按钮代码。"
Case "打开"
mnuFileOpen_Click
Case "保存"
mnuFileSave_Click
Case "打印"
mnuFilePrint_Click
Case "剪切"
mnuEditCut_Click
Case "复制"
mnuEditCopy_Click
Case "粘贴"
mnuEditPaste_Click
Case "粗体"
'应做:添加 '粗体' 按钮代码。
MsgBox "添加 '粗体' 按钮代码。"
Case "斜体"
'应做:添加 '斜体' 按钮代码。
MsgBox "添加 '斜体' 按钮代码。"
Case "下划线"
'应做:添加 '下划线' 按钮代码。
MsgBox "添加 '下划线' 按钮代码。"
Case "左对齐"
'应做:添加 '左对齐' 按钮代码。
MsgBox "添加 '左对齐' 按钮代码。"
Case "置中"
'应做:添加 '置中' 按钮代码。
MsgBox "添加 '置中' 按钮代码。"
Case "右对齐"
'应做:添加 '右对齐' 按钮代码。
MsgBox "添加 '右对齐' 按钮代码。"
End Select
End Sub
Private Sub mnuHelpAbout_Click()
frmAbout.Show vbModal, Me
End Sub
Private Sub mnutxtr_Click()
'应做:添加 'mnutxtr_Click' 代码。
MsgBox "添加 'mnutxtr_Click' 代码。"
End Sub
Private Sub mnutxtl_Click()
'应做:添加 'mnutxtl_Click' 代码。
MsgBox "添加 'mnutxtl_Click' 代码。"
End Sub
Private Sub mnutxtc_Click()
'应做:添加 'mnutxtc_Click' 代码。
MsgBox "添加 'mnutxtc_Click' 代码。"
End Sub
Private Sub mnutxtunderline_Click()
'应做:添加 'mnutxtunderline_Click' 代码。
MsgBox "添加 'mnutxtunderline_Click' 代码。"
End Sub
Private Sub mnutxtitalic_Click()
'应做:添加 'mnutxtitalic_Click' 代码。
MsgBox "添加 'mnutxtitalic_Click' 代码。"
End Sub
Private Sub mnutxtbold_Click()
'应做:添加 'mnutxtbold_Click' 代码。
MsgBox "添加 'mnutxtbold_Click' 代码。"
End Sub
Private Sub mnutxtcolor_Click()
'应做:添加 'mnutxtcolor_Click' 代码。
MsgBox "添加 'mnutxtcolor_Click' 代码。"
End Sub
Private Sub mnutxtfont_Click()
'应做:添加 'mnutxtfont_Click' 代码。
MsgBox "添加 'mnutxtfont_Click' 代码。"
End Sub
Private Sub mnuViewStatusBar_Click()
mnuViewStatusBar.Checked = Not mnuViewStatusBar.Checked
sbStatusBar.Visible = mnuViewStatusBar.Checked
End Sub
Private Sub mnuViewToolbar_Click()
mnuViewToolbar.Checked = Not mnuViewToolbar.Checked
tbToolBar.Visible = mnuViewToolbar.Checked
End Sub
Private Sub mnuEditPaste_Click()
'应做:添加 'mnuEditPaste_Click' 代码。
MsgBox "添加 'mnuEditPaste_Click' 代码。"
End Sub
Private Sub mnuEditCopy_Click()
'应做:添加 'mnuEditCopy_Click' 代码。
MsgBox "添加 'mnuEditCopy_Click' 代码。"
End Sub
Private Sub mnuEditCut_Click()
'应做:添加 'mnuEditCut_Click' 代码。
MsgBox "添加 'mnuEditCut_Click' 代码。"
End Sub
Private Sub mnuFileExit_Click()
'卸载窗体
Unload Me
End Sub
Private Sub mnuFilePrint_Click()
'应做:添加 'mnuFilePrint_Click' 代码。
MsgBox "添加 'mnuFilePrint_Click' 代码。"
End Sub
Private Sub mnuFileSaveAs_Click()
'应做:添加 'mnuFileSaveAs_Click' 代码。
MsgBox "添加 'mnuFileSaveAs_Click' 代码。"
End Sub
Private Sub mnuFileSave_Click()
'应做:添加 'mnuFileSave_Click' 代码。
MsgBox "添加 'mnuFileSave_Click' 代码。"
End Sub
Private Sub mnuFileClose_Click()
'应做:添加 'mnuFileClose_Click' 代码。
MsgBox "添加 'mnuFileClose_Click' 代码。"
End Sub
Private Sub mnuFileOpen_Click()
Dim sFile As String
With dlgCommonDialog
.DialogTitle = "打开"
.CancelError = False
'ToDo: 设置 common dialog 控件的标志和属性
.Filter = "所有文件 (*.*)|*.*"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
sFile = .FileName
End With
RichTextBox1.LoadFile sFile
Caption = sFile
End Sub
Private Sub mnuFileNew_Click()
RichTextBox1.Text = ""
Caption = "notepad"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -