📄 wbrword.frm
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmWbrWord
Caption = "Word 文档"
ClientHeight = 3510
ClientLeft = 60
ClientTop = 630
ClientWidth = 5280
Icon = "WbrWord.frx":0000
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3510
ScaleWidth = 5280
Tag = "Word"
WindowState = 2 'Maximized
Begin MSComctlLib.StatusBar sta
Align = 2 'Align Bottom
Height = 315
Left = 0
TabIndex = 1
Top = 3195
Width = 5280
_ExtentX = 9313
_ExtentY = 556
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin SHDocVwCtl.WebBrowser wbr
Height = 2475
Left = 360
TabIndex = 0
Top = 360
Width = 4515
ExtentX = 7964
ExtentY = 4366
ViewMode = 1
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 0
AutoArrange = -1 'True
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "http:///"
End
Begin VB.Menu mnuFileMenu
Caption = "文件(&F)"
Begin VB.Menu mnuFile
Caption = "打开(&O)..."
Index = 0
End
Begin VB.Menu mnuFile
Caption = "关闭(&C)"
Index = 1
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 2
End
Begin VB.Menu mnuFile
Caption = "保存(&S)"
Index = 3
End
Begin VB.Menu mnuFile
Caption = "另存为(&A)..."
Index = 4
End
Begin VB.Menu mnuFile
Caption = "另存为&HTML..."
Index = 5
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 6
End
Begin VB.Menu mnuFile
Caption = "页面设置(&U)..."
Index = 7
End
Begin VB.Menu mnuFile
Caption = "打印(&P)..."
Index = 8
Shortcut = ^P
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 9
End
Begin VB.Menu mnuFile
Caption = "属性"
Index = 10
Begin VB.Menu mnuFileProps
Caption = "Summary Info"
Index = 0
End
Begin VB.Menu mnuFileProps
Caption = "统计信息"
Index = 1
End
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 11
End
Begin VB.Menu mnuFile
Caption = "关闭(&W)"
Index = 12
End
End
Begin VB.Menu mnuViewMenu
Caption = "视图(&V)"
Begin VB.Menu mnuView
Caption = "普通视图"
Index = 0
End
Begin VB.Menu mnuView
Caption = "页面视图"
Index = 1
End
Begin VB.Menu mnuView
Caption = "-"
Index = 2
End
Begin VB.Menu mnuView
Caption = "水平滚动"
Index = 3
End
Begin VB.Menu mnuView
Caption = "刻度尺"
Index = 4
End
Begin VB.Menu mnuView
Caption = "工具栏"
Index = 5
Begin VB.Menu mnuViewToolbar
Caption = "常用"
Index = 0
End
Begin VB.Menu mnuViewToolbar
Caption = "格式"
Index = 1
End
Begin VB.Menu mnuViewToolbar
Caption = "绘图"
Index = 2
End
Begin VB.Menu mnuViewToolbar
Caption = "Reviewing"
Index = 3
End
End
End
Begin VB.Menu mnuToolsMenu
Caption = "工具(&T)"
Begin VB.Menu mnuTools
Caption = "拼写(&S)"
Index = 0
End
Begin VB.Menu mnuTools
Caption = "词典(&T)..."
Index = 1
End
Begin VB.Menu mnuTools
Caption = "选项(&O)"
Index = 2
Begin VB.Menu mnuOpt
Caption = "显示全部"
Index = 0
End
Begin VB.Menu mnuOpt
Caption = "状态栏"
Checked = -1 'True
Index = 1
End
End
End
End
Attribute VB_Name = "frmWbrWord"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' WbrWord.frm v1.00 (Vb6) Apr 2006 contact markb@orionstudios.com
' Uses WebBrowser Control as container for MS Word Document.
'
' Project/References must include:-
' Microsoft Word 8.0 Object Library (MSWord.olb)
' Microsoft Office 8.0 Object Library (MSO.dll)
' Microsoft Dialog Automation Objects (DlgObjs.dll)
'
' Note settings for the following properties (change for stand-alone form):-
' MDIChild = True
' ControlBox = False
'
'NB: WinWord is started when a Word document is loaded into the
' WebBrowser Control and remains active until that Control is destroyed.
' This can be confirmed using Ctrl-Alt-Del to view the task list.
'=================================================================================
' Module-level Variables
Private MARGINx2 As Long
Private mTopUsedArea As Long ' varies with ToolBar/Captions visibility
Private mBotUsedArea As Long ' varies with StatusBar visibility
Private mVertUsedArea As Long ' = mTopUsedArea + mBotUsedArea
Private mDoc As Word.Document ' Word Document contained by WebBrowser Control
Private mDocURL As String ' URL of Word Document contained by WebBrowser Control
' Module-level Constants
Private Const MARGIN = 0 ' set as required (Twips)
Private Const TITLE_HEAD = "<HEAD>" _
& "<style type='text/css'>" _
& "BODY" _
& "{color:white;" _
& "background-color:#689CD0;" _
& "font:48pt 'Comic Sans MS';" _
& "text-align:center}" _
& "</style>" _
& "</HEAD>"
Private Const TITLE_BODY = "<BODY SCROLL=NO>" _
& "MS Word<BR>Document<BR>Container" _
& "</BODY>"
Private Const TITLE_PAGE = "about:" & TITLE_HEAD & TITLE_BODY
' Browser navigation constants
Private Const navNoHistory = 2
Private Const navNoReadFromCache = 4
Private Const navNoWriteToCache = 8
Private Const mNavFlags = navNoHistory Or navNoReadFromCache Or navNoWriteToCache
' File Menu constants
Private Const FILE_OPEN = 0
Private Const FILE_CLOSE = 1
Private Const FILE_SAVE = 3
Private Const FILE_SAVEAS = 4
Private Const FILE_SAVEASHTML = 5
Private Const FILE_PAGESETUP = 7
Private Const FILE_PRINT = 8
Private Const FILE_PROPS = 10
Private Const FILE_CLOSEWIN = 12
' Properties Menu constants
Private Const PROP_SUMMARY = 0
Private Const PROP_WORDCOUNT = 1
' View Menu constants
Private Const VIEW_NORMAL = 0
Private Const VIEW_PAGE = 1
Private Const VIEW_HSCROLL = 3
Private Const VIEW_RULER = 4
' Tool Menu constants
Private Const TOOLS_SPELL = 0
Private Const TOOLS_THESAURUS = 1
Private Const TOOLS_OPTIONS = 2
' Option Menu constants
Private Const OPT_SHOWALL = 0
Private Const OPT_STATUSBAR = 1
Private Sub Form_Load()
MARGINx2 = MARGIN * 2
mTopUsedArea = MARGIN ' + VB toolbar height, if present
mBotUsedArea = sta.Height
mVertUsedArea = mTopUsedArea + mBotUsedArea
wbr.Navigate TITLE_PAGE, mNavFlags ' Doco says Navigate2 not applicable to VB
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Not (mDoc Is Nothing) Then
If Not mDoc.Saved Then
Cancel = True
MsgBox "This Document has been changed." _
& vbNewLine & vbNewLine _
& "Please Close or Save from the File Menu.", _
vbExclamation, App.FileDescription
End If
End If
End Sub
Private Sub Form_Resize()
On Error Resume Next
wbr.Move MARGIN, mTopUsedArea, Me.ScaleWidth - MARGINx2, Me.ScaleHeight - mVertUsedArea
End Sub
Private Sub mnuFileMenu_Click()
Dim IsWordDoc As Boolean
Dim IsSaved As Boolean
IsWordDoc = Not (mDoc Is Nothing)
If IsWordDoc Then
IsSaved = mDoc.Saved
End If
mnuFile(FILE_CLOSE) = IsWordDoc
mnuFile(FILE_SAVE) = IsWordDoc And Not IsSaved
mnuFile(FILE_SAVEAS) = IsWordDoc
mnuFile(FILE_SAVEASHTML) = IsWordDoc
mnuFile(FILE_PAGESETUP) = IsWordDoc
mnuFile(FILE_PRINT) = IsWordDoc
mnuFile(FILE_PROPS) = IsWordDoc
mnuFile(FILE_CLOSEWIN) = IsSaved Or Not IsWordDoc
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -