📄 webbrowser.frm
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
Begin VB.Form frmWebBrowser
Caption = "Simple Web Browser"
ClientHeight = 3600
ClientLeft = 60
ClientTop = 345
ClientWidth = 5385
LinkTopic = "Form1"
ScaleHeight = 3600
ScaleWidth = 5385
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
Begin VB.CommandButton cmdHome
Caption = "Home"
Height = 375
Left = 4080
TabIndex = 6
Top = 480
Width = 1215
End
Begin VB.CommandButton cmdForward
Caption = "Forward"
Height = 375
Left = 2760
TabIndex = 5
Top = 480
Width = 1215
End
Begin VB.CommandButton cmdBack
Caption = "Back"
Height = 375
Left = 1440
TabIndex = 4
Top = 480
Width = 1215
End
Begin VB.CommandButton cmdGo
Caption = "Go to URL"
Height = 375
Left = 120
TabIndex = 2
Top = 480
Width = 1215
End
Begin VB.TextBox txtURL
Height = 285
Left = 600
TabIndex = 1
Top = 105
Width = 4695
End
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 2535
Left = 0
TabIndex = 0
Top = 1000
Width = 5295
ExtentX = 9340
ExtentY = 4471
ViewMode = 1
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = -1 'True
NoClientEdge = 0 'False
AlignLeft = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = ""
End
Begin VB.Label lblURL
Caption = "URL:"
Height = 240
Left = 120
TabIndex = 3
Top = 135
Width = 375
End
End
Attribute VB_Name = "frmWebBrowser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 19.2
' A simple web browser using the WebBrowser Control.
Option Explicit
Private Sub Form_Load()
' When form is loaded, go to home page
Call WebBrowser1.GoHome
End Sub
Private Sub cmdGo_Click()
' if txtURL is not empty, go to URL specified in txtURL
On Error Resume Next
If txtURL.Text <> "" Then
Call WebBrowser1.Navigate(txtURL.Text)
End If
End Sub
Private Sub cmdBack_Click()
' go to previous page
On Error Resume Next
Call WebBrowser1.GoBack
End Sub
Private Sub cmdForward_Click()
' go to next page
On Error Resume Next
Call WebBrowser1.GoForward
End Sub
Private Sub cmdHome_Click()
' go to home page
On Error Resume Next
Call WebBrowser1.GoHome
End Sub
Private Sub Form_Resize()
' set dimensions of txtURL and WebBrowser1
On Error Resume Next
WebBrowser1.Width = ScaleWidth
WebBrowser1.Height = ScaleHeight - WebBrowser1.Top
txtURL.Width = ScaleWidth - txtURL.Left
End Sub
Private Sub WebBrowser1_DocumentComplete( _
ByVal pDisp As Object, URL As Variant)
' when download complete, display URL in txtURL
txtURL.Text = URL
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -