📄 html.frm
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "浏览器实例"
ClientHeight = 5595
ClientLeft = 60
ClientTop = 345
ClientWidth = 7980
LinkTopic = "Form1"
ScaleHeight = 5595
ScaleWidth = 7980
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 4815
Left = 0
TabIndex = 0
Top = 600
Width = 7815
ExtentX = 13785
ExtentY = 8493
ViewMode = 1
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 0
AutoArrange = -1 'True
NoClientEdge = -1 'True
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.CommandButton StopButton
Caption = "Stop"
Height = 375
Left = 7200
TabIndex = 5
Top = 120
Width = 495
End
Begin VB.CommandButton PrevButton
Caption = "Prev"
Height = 375
Left = 6600
TabIndex = 4
Top = 120
Width = 495
End
Begin VB.CommandButton NextButton
Caption = "Next"
Height = 375
Left = 6000
TabIndex = 3
Top = 120
Width = 495
End
Begin VB.CommandButton GOButton
Caption = "Go"
Height = 375
Left = 5400
TabIndex = 2
Top = 120
Width = 495
End
Begin VB.TextBox Text1
Height = 375
Left = 120
TabIndex = 1
Text = "Text1"
Top = 120
Width = 5175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'当前页面在历史中的页面个数
Dim iCurrent As Integer
'总的浏览过的页面数
Dim iSum As Integer
'初始化
Private Sub Form_Load()
WebBrowser1.GoHome
StopButton.Enabled = False
'在启动之后加载了主页面
'所以当前页面为1
'总页面数为1
iCurrent = 1
iSum = 1
'前进后退都不能进行
PrevButton.Enabled = False
NextButton.Enabled = False
End Sub
'窗体大小调整
Private Sub Form_Resize()
WebBrowser1.Width = Form1.ScaleWidth
WebBrowser1.Height = Form1.ScaleHeight - 600
End Sub
'浏览网页
Private Sub GOButton_Click()
'浏览网页
WebBrowser1.Navigate (Text1.Text)
'总页数增加
iSum = iSum + 1
iCurrent = iSum
'Next按钮失效
NextButton.Enabled = False
'Prev按钮有效
If iSum > 1 Then
PrevButton.Enabled = True
End If
End Sub
'下一个
Private Sub NextButton_Click()
WebBrowser1.GoForward
iCurrent = iCurrent + 1
PrevButton.Enabled = True
If iCurrent = iSum Then
NextButton.Enabled = False
End If
End Sub
'上一个
Private Sub PrevButton_Click()
WebBrowser1.GoBack
iCurrent = iCurrent - 1
NextButton.Enabled = True
If iCurrent = 1 Then
PrevButton.Enabled = False
End If
End Sub
'停止
Private Sub StopButton_Click()
WebBrowser1.Stop
End Sub
'浏览页面
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
GOButton_Click
End If
End Sub
'开始浏览前,即开始下载网页
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
'使能Stop按钮
StopButton.Enabled = True
End Sub
'下载网页结束
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
'停止按钮失效
StopButton.Enabled = False
End Sub
Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -