📄 frmmain.frm
字号:
On Error Resume Next
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnRedo
End Sub
Private Sub mnuSetCellByName_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetCellByName
End Sub
Private Sub mnuFormProtect_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.FormProtect Then
ActiveForm.Formvw1.FormProtect = False
Else
ActiveForm.Formvw1.FormProtect = True
End If
mnuFormProtect.Checked = ActiveForm.Formvw1.FormProtect
End Sub
Private Sub mnuSetColLabel_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.GetColLabel() > 0 Then
ActiveForm.Formvw1.SetColLabel (0)
mnuSetColLabel.Checked = False
Else
ActiveForm.Formvw1.SetColLabel (ActiveForm.Formvw1.Col)
mnuSetColLabel.Checked = True
End If
End Sub
Private Sub mnuSetRowLabel_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.GetRowLabel() > 0 Then
ActiveForm.Formvw1.SetRowLabel (0)
mnuSetRowLabel.Checked = False
Else
ActiveForm.Formvw1.SetRowLabel (ActiveForm.Formvw1.Row)
mnuSetRowLabel.Checked = True
End If
End Sub
Private Sub mnuShowErrMsgBox_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.ShowErrorMsgBox Then
ActiveForm.Formvw1.ShowErrorMsgBox = False
Else
ActiveForm.Formvw1.ShowErrorMsgBox = True
End If
mnuShowErrMsgBox.Checked = ActiveForm.Formvw1.ShowErrorMsgBox
End Sub
Private Sub mnuShowGrid_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.ShowGrid Then
ActiveForm.Formvw1.ShowGrid = False
Else
ActiveForm.Formvw1.ShowGrid = True
End If
mnuShowGrid.Checked = ActiveForm.Formvw1.ShowGrid
End Sub
Private Sub mnuShowHeader_Click()
If ActiveForm Is Nothing Then Exit Sub
If ActiveForm.Formvw1.ShowHeader Then
ActiveForm.Formvw1.ShowHeader = False
Else
ActiveForm.Formvw1.ShowHeader = True
End If
mnuShowHeader.Checked = ActiveForm.Formvw1.ShowHeader
End Sub
Private Sub mnuStyleCellBackground_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetCellBkColor
End Sub
Private Sub mnuStyleCellFont_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnChooseFont
End Sub
Private Sub mnuStyleCellShowStyle_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetCellShowStyle
End Sub
Private Sub mnuStyleCombiNation_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnLineCombiNation
End Sub
Private Sub mnuStyleDefaultSet_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDefaultSet
End Sub
Private Sub mnuStyleLineStyle_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetLineStyle
End Sub
Private Sub mnuStyleSlashSet_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSlashSet
End Sub
Private Sub mnuStyleTextAlign_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnTextAlign
End Sub
Private Sub mnuStyleTextColor_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetTextColor
End Sub
Private Sub mnuSysDatabaseSource_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetSysDatabaseSource
End Sub
Private Sub mnuUnCombiNation_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnCellCombiNation (False)
End Sub
Private Sub mnuUserFunctionGuide_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.UserFunctionGuide
End Sub
Private Sub mnuZoomScale_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnZoomScale
End Sub
Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "New"
LoadNewDoc
Case "Open"
mnuFileOpen_Click
Case "Save"
mnuFileSave_Click
Case "PrintPreview"
mnuFilePrintPreview_Click
Case "Print"
mnuFilePrint_Click
Case "Cut"
mnuEditCut_Click
Case "Copy"
mnuEditCopy_Click
Case "Paste"
mnuEditPaste_Click
Case "Bold"
ActiveForm.Formvw1.Bold = Not ActiveForm.Formvw1.Bold
Button.Value = IIf(ActiveForm.Formvw1.Bold, tbrPressed, tbrUnpressed)
Case "Italic"
ActiveForm.Formvw1.Italic = Not ActiveForm.Formvw1.Italic
Button.Value = IIf(ActiveForm.Formvw1.Italic, tbrPressed, tbrUnpressed)
Case "Underline"
ActiveForm.Formvw1.Underline = Not ActiveForm.Formvw1.Underline
Button.Value = IIf(ActiveForm.Formvw1.Underline, tbrPressed, tbrUnpressed)
Case "Horz Left"
ActiveForm.Formvw1.HorzTextAlign = 1
Case "Horz Center"
ActiveForm.Formvw1.HorzTextAlign = 2
Case "Horz Right"
ActiveForm.Formvw1.HorzTextAlign = 3
Case "Vert Top"
ActiveForm.Formvw1.VertTextAlign = 1
Case "Vert Center"
ActiveForm.Formvw1.VertTextAlign = 2
Case "Vert Bottom"
ActiveForm.Formvw1.VertTextAlign = 3
Case "Line Style"
mnuStyleLineStyle_Click
Case "SlashLine"
mnuStyleSlashSet_Click
Case "ChartWizard"
mnuChartWizard_Click
End Select
End Sub
Private Sub mnuHelpAbout_Click()
frmAbout.Show vbModal, Me
End Sub
Private Sub mnuHelpSearchForHelpOn_Click()
App.HelpFile = App.Path & "\ChinaExcel.CHM"
Call Htmlhelp(hwnd, App.HelpFile, HH_DISPLAY_TOPIC, ByVal ("html/welcome.htm"))
End Sub
Private Sub mnuHelpContents_Click()
App.HelpFile = App.Path & "\ChinaExcel.CHM"
'程序调用
'调用缺省主题帮助
Call Htmlhelp(hwnd, App.HelpFile, HH_DISPLAY_TOPIC, ByVal "html/welcome.htm")
End Sub
Private Sub mnuWindowTileVertical_Click()
Me.Arrange vbTileVertical
End Sub
Private Sub mnuWindowTileHorizontal_Click()
Me.Arrange vbTileHorizontal
End Sub
Private Sub mnuWindowCascade_Click()
Me.Arrange vbCascade
End Sub
Private Sub mnuWindowNewWindow_Click()
LoadNewDoc
End Sub
Private Sub mnuViewWebBrowser_Click()
Dim frmB As New frmBrowser
frmB.StartingAddress = "http://www.chinaexcel.com"
frmB.Show
End Sub
Private Sub mnuViewOptions_Click()
'ToDo: Add 'mnuViewOptions_Click' code.
MsgBox "Add 'mnuViewOptions_Click' code."
End Sub
Private Sub mnuViewRefresh_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.Refresh
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()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnPaste
End Sub
Private Sub mnuEditCopy_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnCopy
End Sub
Private Sub mnuEditCut_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnCut
End Sub
Private Sub mnuEditUndo_Click()
On Error Resume Next
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnUndo
End Sub
Private Sub mnuFileExit_Click()
'unload the form
Unload Me
End Sub
Private Sub mnuFilePrint_Click()
On Error Resume Next
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnFilePrint
End Sub
Private Sub mnuFilePrintPreview_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnFilePrintPreview
End Sub
Private Sub mnuFilePageSetup_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnPrintPaperSet
End Sub
Private Sub mnuFileSaveAll_Click()
'ToDo: Add 'mnuFileSaveAll_Click' code.
' MsgBox "Add 'mnuFileSaveAll_Click' code."
End Sub
Private Sub mnuFileSaveAs_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnFileSave
ActiveForm.Caption = ActiveForm.Formvw1.FilePathName
End Sub
Private Sub mnuFileSave_Click()
If ActiveForm Is Nothing Then Exit Sub
If Left$(ActiveForm.Caption, 2) = "表格" Then
ActiveForm.Formvw1.OnFileSave
Else
ActiveForm.Formvw1.SaveFile (ActiveForm.Caption)
End If
ActiveForm.Caption = ActiveForm.Formvw1.FilePathName
End Sub
Private Sub mnuFileClose_Click()
Unload ActiveForm
'ToDo: Add 'mnuFileClose_Click' code.
' MsgBox "Add 'mnuFileClose_Click' code."
End Sub
Private Sub mnuFileOpen_Click()
If ActiveForm Is Nothing Then LoadNewDoc
ActiveForm.Formvw1.ShowErrorMsgBox = False
ActiveForm.Formvw1.OnFileOpen
ActiveForm.Caption = ActiveForm.Formvw1.FilePathName
mnuShowHeader.Checked = ActiveForm.Formvw1.ShowHeader
mnuShowGrid.Checked = ActiveForm.Formvw1.ShowGrid
mnuShowErrMsgBox.Checked = ActiveForm.Formvw1.ShowErrorMsgBox
mnuFormProtect.Checked = ActiveForm.Formvw1.FormProtect
mnuDesignMode.Checked = ActiveForm.Formvw1.DesignMode
If ActiveForm.Formvw1.GetRowLabel() = 0 Then
mnuSetRowLabel.Checked = False
Else
mnuSetRowLabel.Checked = True
End If
If ActiveForm.Formvw1.GetColLabel() = 0 Then
mnuSetColLabel.Checked = False
Else
mnuSetColLabel.Checked = True
End If
End Sub
Private Sub mnuFileNew_Click()
LoadNewDoc
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim StartRow As Integer
Dim StartCol As Integer
Dim EndRow As Integer
Dim EndCol As Integer
On Error Resume Next
Select Case Button.Key
Case "cell combination"
mnuCellCombiNation_Click
Case "cell uncombination"
mnuUnCombiNation_Click
Case "insert cell"
mnuEditInsertCellDlg_Click
Case "insert row"
mnuEditInsertbBeforeRow_Click
Case "insert col"
mnuEditInsertBeforeCol_Click
Case "text color"
mnuStyleTextColor_Click
Case "cell backcolor"
mnuStyleCellBackground_Click
Case "Sum"
ActiveForm.Formvw1.GetSelectRegion StartRow, StartCol, EndRow, EndCol
ActiveForm.Formvw1.AutoSum StartRow, StartCol, EndRow, EndCol, 3
ActiveForm.GetFocus
Case "function"
mnuFunctionList_Click
Case "ClearCell"
mnuEditClearCell_Click
Case "DeleteCell"
mnuEditDeleteCellDlg_Click
Case "DeleteRow"
mnuEditDeleteRow_Click
Case "DeleteCol"
mnuEditDeleteCol_Click
Case "CellSet"
mnuCellSet_Click
Case "HomePage"
mnuViewWebBrowser_Click
Case "databasewizard"
mnuDatabaseWizard_Click
Case "DatabaseSource"
mnuSysDatabaseSource_Click
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -