📄 vb_web.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 frmWebBrowser
Caption = "我的浏览器^_^"
ClientHeight = 7080
ClientLeft = 60
ClientTop = 345
ClientWidth = 10440
LinkTopic = "Form1"
ScaleHeight = 7080
ScaleWidth = 10440
StartUpPosition = 3 '窗口缺省
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 5880
TabIndex = 7
Top = 10440
Width = 4815
_ExtentX = 8493
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 8
Top = 6705
Width = 10440
_ExtentX = 18415
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.CommandButton cmdStop
Height = 615
Left = 1920
Picture = "vb_web.frx":0000
Style = 1 'Graphical
TabIndex = 6
Top = 120
Width = 615
End
Begin VB.TextBox txtURL
Height = 375
Left = 3240
TabIndex = 5
Text = "about:blank"
Top = 240
Width = 4815
End
Begin VB.CommandButton cmdStartIE
Height = 615
Left = 2520
Picture = "vb_web.frx":0442
Style = 1 'Graphical
TabIndex = 4
ToolTipText = "Full Browser"
Top = 120
Width = 615
End
Begin VB.CommandButton cmdRefresh
Height = 615
Left = 1320
Picture = "vb_web.frx":0884
Style = 1 'Graphical
TabIndex = 3
ToolTipText = "Refresh"
Top = 120
Width = 615
End
Begin VB.CommandButton cmdForward
Height = 615
Left = 720
Picture = "vb_web.frx":0CC6
Style = 1 'Graphical
TabIndex = 2
ToolTipText = "Next page"
Top = 120
Width = 615
End
Begin VB.CommandButton cmdBack
Height = 615
Left = 120
Picture = "vb_web.frx":1108
Style = 1 'Graphical
TabIndex = 1
ToolTipText = "Previous page"
Top = 120
Width = 615
End
Begin SHDocVwCtl.WebBrowser ctlWeb
Height = 8655
Left = 120
TabIndex = 0
Top = 1200
Width = 10455
ExtentX = 18441
ExtentY = 15266
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
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
End
Attribute VB_Name = "frmWebBrowser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const MARGIN = 60
Private Sub cmdBack_Click()
On Error Resume Next
ctlWeb.GoBack
End Sub
Private Sub cmdForward_Click()
On Error Resume Next
ctlWeb.GoForward
End Sub
Private Sub cmdRefresh_Click()
On Error Resume Next
ctlWeb.Refresh
End Sub
Private Sub cmdStartIE_Click()
Dim objIE As Object
Set objIE = CreatObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate2 CStr(txtURL.Text), Null, Null, Null, Null
End Sub
Private Sub cmdStop_Click()
On Error Resume Next
ctlWeb.Stop
End Sub
Private Sub ctlWeb_DownloadBegin()
StatusBar1.SimpleText = "载入中…"
End Sub
Private Sub ctlWeb_DownloadComplete()
StatusBar1.SimpleText = "下载完成"
ProgressBar1.Value = 0
End Sub
Private Sub ctlWeb_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
If ProgressMax = 0 Then Exit Sub
ProgressBar1.Max = ProgressMax
If Progress <> -1 And Progress <= ProgressMax Then
ProgressBar1.Value = Progress
End If
End Sub
Private Sub Form_Load()
ctlWeb.Navigate "about blank"
End Sub
Private Sub Form_Resize()
On Error Resume Next
txtURL.Width = Me.ScaleWidth - txtURL.Left - MARGIN
ctlWeb.Width = Me.ScaleWidth - (2 * MARGIN)
ctlWeb.Height = Me.ScaleHeight - ctlWeb.Top - MARGIN
End Sub
Private Sub txtURL_GotFocus()
txtURL.SelStart = 0
txtURL.SelLength = Len(txtURL)
End Sub
Private Sub txtURL_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
If InStr(txtURL, "://") = 0 Then
txtURL = "http://" & txtURL
End If
ctlWeb.Navigate txtURL
End If
End Sub
Public Sub Navigate(sURL As String)
If insr(sURL, "://") = 0 Then
txtURL = "http://" & sURL
Else
txtURL = sURL
End If
ctlWeb.Navigate txtURL
Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -