📄 frmmain.frm
字号:
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Sub MDIForm_Initialize()
InitCommonControls
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)
Load FrmWIK
FrmWIK.Hide
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 OSD_Click()
Dim fLogin As New frmLogin
fLogin.Show vbModal
If fLogin.OK Then
Unload fLogin
显示房态标志 = True
Load OSD_LISK
'OSD_LISK.Show
End If
End Sub
Private Sub SET_Click()
Dim fLogin As New frmLogin
fLogin.Show vbModal
If fLogin.OK Then
Unload fLogin
Load FrmSET
End If
End Sub
Private Sub SETRCU_Click()
Dim fLogin As New frmLogin
fLogin.Show vbModal
If fLogin.OK Then
Unload fLogin
Load FrmSETRCU
End If
End Sub
Private Sub DDC_Click()
Dim fLogin As New frmLogin
fLogin.Show vbModal
If fLogin.OK Then
Unload fLogin
Load Form1
End If
End Sub
Private Sub tbToolBar_ButtonClick(ByVal Button As MSComCtlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "新建"
' LoadNewDoc
Case "打开"
mnuFileOpen_Click
Case "保存"
mnuFileSave_Click
Case "打印"
mnuFilePrint_Click
Case "剪切"
'应做:添加 '剪切' 按钮代码。
' MsgBox "添加 '剪切' 按钮代码。"
Case "复制"
'应做:添加 '复制' 按钮代码。
' MsgBox "添加 '复制' 按钮代码。"
Case "粘贴"
'应做:添加 '粘贴' 按钮代码。
' MsgBox "添加 '粘贴' 按钮代码。"
Case "查找"
'应做:添加 '查找' 按钮代码。
' MsgBox "添加 '查找' 按钮代码。"
Case "列表"
Case "向上一级"
'应做:添加 '向上一级' 按钮代码。
' MsgBox "添加 '向上一级' 按钮代码。"
End Select
End Sub
Private Sub mnuHelpAbout_Click()
MsgBox "版本 " & App.Major & "." & App.Minor & "." & App.Revision
End Sub
Private Sub mnuHelpSearchForHelpOn_Click()
Dim nRet As Integer
'如果这个工程没有帮助文件,显示消息给用户
'可以在“工程属性”对话框中为应用程序设置帮助文件
If Len(App.HelpFile) = 0 Then
MsgBox "无法显示帮助目录,该工程没有相关联的帮助。", vbInformation, Me.Caption
Else
On Error Resume Next
nRet = OSWinHelp(Me.hwnd, App.HelpFile, 261, 0)
If ERR Then
MsgBox ERR.Description
End If
End If
End Sub
Private Sub mnuHelpContents_Click()
Dim nRet As Integer
'如果这个工程没有帮助文件,显示消息给用户
'可以在“工程属性”对话框中为应用程序设置帮助文件
If Len(App.HelpFile) = 0 Then
MsgBox "无法显示帮助目录,该工程没有相关联的帮助。", vbInformation, Me.Caption
Else
On Error Resume Next
nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0)
If ERR Then
MsgBox ERR.Description
End If
End If
End Sub
Private Sub mnuFileExit_Click()
'卸载窗体
Unload Me
End Sub
Private Sub mnuFilePrint_Click()
On Error Resume Next
If ActiveForm Is Nothing Then Exit Sub
With dlgCommonDialog
.DialogTitle = "Print"
.CancelError = True
.Flags = cdlPDReturnDC + cdlPDNoPageNums
If ActiveForm.rtfText.SelLength = 0 Then
.Flags = .Flags + cdlPDAllPages
Else
.Flags = .Flags + cdlPDSelection
End If
.ShowPrinter
If ERR <> MSComDlg.cdlCancel Then
ActiveForm.rtfText.SelPrint .hDC
End If
End With
End Sub
Private Sub mnuFilePrintPreview_Click()
'应做:添加 'mnuFilePrintPreview_Click' 代码。
' MsgBox "添加 'mnuFilePrintPreview_Click' 代码。"
End Sub
Private Sub mnuFileSaveAs_Click()
Dim sFile As String
If ActiveForm Is Nothing Then Exit Sub
With dlgCommonDialog
.DialogTitle = "另存为"
.CancelError = False
'ToDo: 设置 common dialog 控件的标志和属性
.Filter = "所有文件 (*.*)|*.*"
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
sFile = .FileName
End With
ActiveForm.Caption = sFile
ActiveForm.rtfText.SaveFile sFile
End Sub
Private Sub mnuFileSave_Click()
Dim sFile As String
If Left$(ActiveForm.Caption, 8) = "Document" Then
With dlgCommonDialog
.DialogTitle = "保存"
.CancelError = False
'ToDo: 设置 common dialog 控件的标志和属性
.Filter = "所有文件 (*.*)|*.*"
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
sFile = .FileName
End With
ActiveForm.rtfText.SaveFile sFile
Else
sFile = ActiveForm.Caption
ActiveForm.rtfText.SaveFile sFile
End If
End Sub
Private Sub mnuFileClose_Click()
'应做:添加 'mnuFileClose_Click' 代码。
MsgBox "添加 'mnuFileClose_Click' 代码。"
End Sub
Private Sub mnuFileOpen_Click()
Dim sFile As String
' If ActiveForm Is Nothing Then LoadNewDoc
With dlgCommonDialog
.DialogTitle = "打开"
.CancelError = False
'ToDo: 设置 common dialog 控件的标志和属性
.Filter = "所有文件 (*.*)|*.*"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
sFile = .FileName
End With
ActiveForm.rtfText.LoadFile sFile
ActiveForm.Caption = sFile
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -