📄 11-1.frm
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5715
ClientLeft = 165
ClientTop = 735
ClientWidth = 7920
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 5715
ScaleWidth = 7920
StartUpPosition = 3 '窗口缺省
Begin SHDocVwCtl.WebBrowser Web1
Height = 2295
Left = 1680
TabIndex = 5
Top = 1680
Width = 4575
ExtentX = 8070
ExtentY = 4048
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 MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 285
Left = 0
TabIndex = 4
Top = 5430
Width = 7920
_ExtentX = 13970
_ExtentY = 503
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 0
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 41
ImageHeight = 37
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 6
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":040C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":0818
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":0C24
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":1030
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "11-1.frx":143C
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 675
Left = 0
TabIndex = 3
Top = 0
Width = 7920
_ExtentX = 13970
_ExtentY = 1191
ButtonWidth = 1270
ButtonHeight = 1138
Wrappable = 0 'False
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 7
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Prev"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Next"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Stop"
ImageIndex = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Flesh"
ImageIndex = 4
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "HomePage"
ImageIndex = 5
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Search"
ImageIndex = 6
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 720
Top = 1440
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Frame Frame1
Height = 495
Left = 30
TabIndex = 0
Top = 615
Width = 3750
Begin VB.ComboBox Combo1
Height = 300
Left = 1155
TabIndex = 1
Text = "Combo1"
Top = 135
Width = 2040
End
Begin VB.Label Label1
Caption = " 连接地址:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 75
TabIndex = 2
Top = 195
Width = 1155
End
End
Begin VB.Menu File
Caption = "文件(&F)"
Begin VB.Menu Open
Caption = "打开(&O)"
End
Begin VB.Menu S
Caption = "-"
End
Begin VB.Menu Exit
Caption = "退出(&E)"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const AppName As String = "VB Explorer"
Private Sub Combo1_Click()
If Len(Combo1.Text) <= 0 Then
Exit Sub
End If
ChangeList Combo1.Text '改变列表显示
Web1.Navigate Combo1.Text '开始下载主页
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Call Combo1_Click
End If
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Text = ""
'读列表信息
LoadList
'访问当前节点
Web1.Navigate Combo1.Text
End Sub
Private Sub Form_Resize()
Frame1.Move Me.ScaleLeft, Frame1.Top, Me.ScaleWidth
If Frame1.Width > Combo1.Left + Label1.Left Then
'Width 属性不能小于 0
Combo1.Width = Frame1.Width - Combo1.Left - Label1.Left
End If
'修改 Web1 的位置、大小
Web1.Left = Me.ScaleLeft
Web1.Top = Frame1.Height + Frame1.Top
Web1.Width = Me.ScaleWidth
If Me.ScaleHeight - StatusBar1.Height - Web1.Top > 0 Then
'Height 属性不能小于 0
Web1.Height = Me.ScaleHeight - StatusBar1.Height - Web1.Top
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveList '保存列表信息
End Sub
Private Sub Open_Click()
With CommonDialog1
'指定文件过滤器
.Filter = "Web文档 (*.htm)|*.htm" _
+ "|ActiveX文档 (*.vbd)|*.vbd" _
+ "|所有文件 (*.*)|*.*"
'清空文件名
.FileName = ""
'显示“打开文件”对话框
.ShowOpen
'正确返回文件名
If Len(.FileName) < 1 Then
Exit Sub
End If
Combo1.Text = .FileName
End With
Combo1_Click
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As Button)
On Error GoTo Error '增加错误处理
Select Case Button.Key
Case "Prev"
Web1.GoBack
Case "Next"
Web1.GoForward
Case "Stop"
Web1.Stop
Case "Flesh"
Web1.Refresh
Case "HomePage"
Web1.GoHome
Case "Search"
Web1.GoSearch
End Select
'退出子程序
Exit Sub
Error: '错误处理
Resume Next '忽略错误,继续执行
End Sub
Private Sub Web1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
StatusBar1.SimpleText = "正在连接 : " + URL
End Sub
Private Sub Web1_DownloadComplete()
On Error Resume Next
Me.Caption = Web1.LocationName
End Sub
Private Sub Web1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
StatusBar1.SimpleText = "当前位置 : " + URL
End Sub
Private Sub Web1_StatusTextChange(ByVal Text As String)
StatusBar1.SimpleText = Text
End Sub
Private Sub ChangeList(NewItem As String)
Dim i As Integer
'如果是列表中第一项,返回
If NewItem = Combo1.List(0) Then
Exit Sub
End If
'删除列表中相同项
For i = 1 To Combo1.ListCount - 1
If NewItem = Combo1.List(i) Then
Combo1.RemoveItem i '列表中已有相同项
End If
Next i
Combo1.AddItem NewItem, 0 '增加列表项
Combo1.ListIndex = 0 '设置当前显示项
'注意:设置该参数将触发控件的 Click 事件
End Sub
Private Sub LoadList()
Dim i As Integer
Dim varURLs As Variant ' 存储返回的数组的变量
'判断是否存有文件
If GetSetting(AppName, "Recent", "RecentURL1") = Empty Then
Exit Sub
End If
'获得“Recent”主键中的全部键值
varURLs = GetAllSettings(AppName, "Recent")
'显示已有 URL 地址
For i = 0 To UBound(varURLs, 1)
'UBound(arrayname[, dimension])函数返回指定的数组可用的最大下标
'dimension为可选参数,用于指定返回哪一维的上界。1 表示第一维。
Combo1.AddItem varURLs(i, 1)
Next i
Combo1.ListIndex = 0 '设置列表当前显示
End Sub
Private Sub SaveList()
Dim i As Integer
Dim Key As String
'判断是否存有文件
If GetSetting(AppName, "Recent", "RecentURL1") <> Empty Then
DeleteSetting AppName, "Recent" '删除 Recent 主键中的全部数据
End If
'保存当前列表
For i = 0 To Combo1.ListCount - 1
Key = "RecentURL" & i
SaveSetting AppName, "Recent", Key, Combo1.List(i)
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -