📄 frmmain.frm
字号:
End
Begin VB.Menu mnuDrawToolBar0
Caption = "-"
End
Begin VB.Menu mnuDrawLine
Caption = "画线"
End
Begin VB.Menu mnuRectangle
Caption = "画矩形"
End
Begin VB.Menu mnuDrawRoundRectangle
Caption = "画圆角矩形"
End
Begin VB.Menu mnuDrawEllipse
Caption = "画椭圆"
End
Begin VB.Menu mnuDrawPolygon
Caption = "画Polygon"
Visible = 0 'False
End
Begin VB.Menu mnuPicBar0
Caption = "-"
End
Begin VB.Menu mnuLineColor
Caption = "边框颜色"
End
Begin VB.Menu mnuFillColor
Caption = "填充颜色"
End
Begin VB.Menu mnuMoveToFront
Caption = "移到最顶层"
End
Begin VB.Menu mnuMoveToBack
Caption = "移到最底层"
End
Begin VB.Menu mnuMoveFroward
Caption = "移到上一层"
End
Begin VB.Menu mnuMoveBack
Caption = "移到下一层"
End
End
Begin VB.Menu mnuDatabase
Caption = "数据(&D)"
Begin VB.Menu mnuDatabaseWizard
Caption = "数据库向导"
End
Begin VB.Menu mnuSysDatabaseSource
Caption = "系统数据源(&S)"
End
Begin VB.Menu mnuODBCConnectTest
Caption = "ODBC连接测试"
End
End
Begin VB.Menu mnuWindow
Caption = "窗口(&W)"
WindowList = -1 'True
Begin VB.Menu mnuWindowNewWindow
Caption = "新窗口(&N)"
End
Begin VB.Menu mnuWindowBar0
Caption = "-"
End
Begin VB.Menu mnuWindowCascade
Caption = "层叠(&C)"
End
Begin VB.Menu mnuWindowTileHorizontal
Caption = "水平平铺(&H)"
End
Begin VB.Menu mnuWindowTileVertical
Caption = "垂直平铺(&V)"
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpContents
Caption = "目录索引(&C)"
End
Begin VB.Menu mnuHelpSearchForHelpOn
Caption = "搜索(&S)..."
Visible = 0 'False
End
Begin VB.Menu mnuHelpBar0
Caption = "-"
Visible = 0 'False
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 Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Private Declare Function Htmlhelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Any) As Long
Const HH_DISPLAY_TOPIC = &H0
Const HH_DISPLAY_INDEX = &H2
Const HH_HELP_CONTEXT = &HF
Const HH_DISPLAY_SEARCH = &H3
Const HH_DISPLAY_TEXT_POPUP = &HE
Const EM_UNDO = &HC7
Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
Private Sub ComboFontName_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.CellFontName = Me.ComboFontName.List(Me.ComboFontName.ListIndex)
ActiveForm.Formvw1.GetFocus
End Sub
Private Sub ComboFontSize_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.CellFontSize = Me.ComboFontSize.List(Me.ComboFontSize.ListIndex)
ActiveForm.Formvw1.GetFocus
End Sub
Private Sub MDIForm_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)
LoadNewDoc
FileName = Command
If FileName <> "" Then
ActiveForm.Formvw1.OpenFile (FileName)
ActiveForm.Caption = ActiveForm.Formvw1.FilePathName
End If
End Sub
Private Sub LoadNewDoc()
Static lDocumentCount As Long
Dim frmD As frmDocument
lDocumentCount = lDocumentCount + 1
Set frmD = New frmDocument
frmD.Caption = "表格" & lDocumentCount
frmD.Formvw1.FilePathName = frmD.Caption
mnuShowHeader.Checked = frmD.Formvw1.ShowHeader
mnuShowGrid.Checked = frmD.Formvw1.ShowGrid
mnuShowErrMsgBox.Checked = frmD.Formvw1.ShowErrorMsgBox
mnuFormProtect.Checked = frmD.Formvw1.FormProtect
mnuDesignMode.Checked = frmD.Formvw1.DesignMode
mnuAutoWrap.Checked = frmD.Formvw1.AutoWrap
If frmD.Formvw1.GetRowLabel() = 0 Then
mnuSetRowLabel.Checked = False
Else
mnuSetRowLabel.Checked = True
End If
If frmD.Formvw1.GetColLabel() = 0 Then
mnuSetColLabel.Checked = False
Else
mnuSetColLabel.Checked = True
End If
frmD.Show
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
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 mnuAutoWrap_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.AutoWrap = Not ActiveForm.Formvw1.AutoWrap
mnuAutoWrap.Checked = ActiveForm.Formvw1.AutoWrap
End Sub
Private Sub mnuCalculate_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnReCalculate
End Sub
Private Sub mnuCalculateAll_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.ReCalculate
End Sub
Private Sub mnuCellCombiNation_Click()
If ActiveForm Is Nothing Then Exit Sub
Call ActiveForm.Formvw1.OnCellCombiNation(True)
End Sub
Private Sub mnuCellSet_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnSetCellHideProtect
End Sub
Private Sub mnuChartWizard_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnChartWizard
End Sub
Private Sub mnuDatabaseWizard_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDatabaseWizard
End Sub
Private Sub mnuDesignMode_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.DesignMode = Not ActiveForm.Formvw1.DesignMode
mnuDesignMode.Checked = ActiveForm.Formvw1.DesignMode
End Sub
Private Sub mnuDrawEllipse_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDrawEllipse
End Sub
Private Sub mnuDrawLine_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDrawLine
End Sub
Private Sub mnuDrawPolygon_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDrawPolygon
End Sub
Private Sub mnuDrawRoundRectangle_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDrawRoundRect
End Sub
Private Sub mnuEditClearCell_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnClearCell
End Sub
Private Sub mnuEditDeleteCellDlg_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDeleteCell
End Sub
Private Sub mnuEditDeleteCellLeft_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDeleteCellLeft
End Sub
Private Sub mnuEditDeleteCellUp_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDeleteCellUp
End Sub
Private Sub mnuEditDeleteCol_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDeleteCol
End Sub
Private Sub mnuEditDeleteRow_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDeleteRow
End Sub
Private Sub mnuEditInsertbBeforeRow_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertBeforeRow
End Sub
Private Sub mnuEditInsertBeforeCol_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertBeforeCol
End Sub
Private Sub mnuEditInsertbNextRow_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertNextRow
End Sub
Private Sub mnuEditInsertCellDlg_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertCell
End Sub
Private Sub mnuEditInsertCellDown_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertCellDown
End Sub
Private Sub mnuEditInsertCellRight_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertCellRight
End Sub
Private Sub mnuEditInsertNextCol_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnInsertNextCol
End Sub
Private Sub mnuExportUserFunctions_Click()
ExcelFileDialog.DialogTitle = "选择保存文件名"
ExcelFileDialog.Filter = "自定义函数文件(*.xfb)|*.xfb"
ExcelFileDialog.ShowSave
If ExcelFileDialog.FileName = "" Then
Exit Sub
End If
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.ExportUserFunctions (ExcelFileDialog.FileName)
End Sub
Private Sub mnuFillColor_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectFillColor
End Sub
Private Sub mnuFunctionList_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnFunctionList
End Sub
Private Sub mnuGoToCell_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnGoToCell
End Sub
Private Sub mnuImportUserFunctions_Click()
ExcelFileDialog.DialogTitle = "选择打开文件名"
ExcelFileDialog.Filter = "自定义函数文件(*.xfb)|*.xfb"
ExcelFileDialog.ShowOpen
If ExcelFileDialog.FileName = "" Then
Exit Sub
End If
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.ImportUserFunctions (ExcelFileDialog.FileName)
End Sub
Private Sub mnuJumpNextCol_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.JumpNextCol
mnuJumpNextRow.Checked = False
mnuJumpNextCol.Checked = True
End Sub
Private Sub mnuJumpNextRow_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.JumpNextRow
mnuJumpNextRow.Checked = True
mnuJumpNextCol.Checked = False
End Sub
Private Sub mnuLineColor_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectLineColor
End Sub
Private Sub mnuMoveBack_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectMoveBack
End Sub
Private Sub mnuMoveFroward_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectMoveForward
End Sub
Private Sub mnuMoveToBack_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectMoveToBack
End Sub
Private Sub mnuMoveToFront_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnObjectMoveToFront
End Sub
Private Sub mnuODBCConnectTest_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnODBCConnectTest
End Sub
Function IsExcelRunning() As Boolean
Dim xlApp As Excel.Application
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
IsExcelRunning = (Err.Number = 0)
Set xlApp = Nothing
Err.Clear
End Function
Private Sub mnuRectangle_Click()
If ActiveForm Is Nothing Then Exit Sub
ActiveForm.Formvw1.OnDrawRect
End Sub
Private Sub mnuRedo_Click()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -