日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

用VB制作自己的IE网页浏览器

發布時間:2023/12/18 HTML 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用VB制作自己的IE网页浏览器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
用VB制作自己的IE網頁瀏覽器
2011年04月23日
  1、在工具箱中添加“Microsoft Internet Controls”控件;
  “microsoft common dialog control 6.0”控件;
  “Microsoft Windows Common Control”控件;
  2、在Form1窗口中添加添加1個ComboBox控件,5個CommandButton控件,
  1個Common Dialpg控件,1個WebBrowser控件;
  1個StatusBar控件和1個ProgressBar控件。
  如圖所示:
  http://b63.photo.store.qq.com/http_imgload.cgi?/rurl4_b=e64038147f12951908f2522c130c4b8faf3f009dc31e83519b14dc80c05d50f214adba8fbcd4b09a7a6e4202a3489409a7f9aee1717e4aa893b2f05c0e0d899a0328563e19869fe9c9e4c14fe7cf05994bbe399b&a=63&b=63
  3、雙擊Form1窗口,輸入下列代碼:
  Option Explicit
  Private Sub Combo1_Click()
  WebBrowser1.Navigate Combo1.Text ' 打開指定網址
  End Sub
  Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  Dim I As Long
  Dim existed As Boolean
  If KeyCode = 13 Then
  If Left(Combo1.Text, 7) "http://" Then '如果輸入網址不是以“http://”開頭則自動添加
  Combo1.Text = "http://" + Combo1.Text + ".com"
  End If
  WebBrowser1.Navigate Combo1.Text ' URL地址欄保存的網站地址
  For I = 0 To Combo1.ListCount - 1
  If Combo1.List(I) = Combo1.Text Then
  existed = True
  Exit For
  Else
  existed = False
  End If
  Next
  If Not existed Then
  Combo1.AddItem (Combo1.Text) ' 如果輸入新的網站則自動保存
  End If
  End If
  End Sub
  Private Sub Command1_Click()
  WebBrowser1.GoSearch
  End Sub
  Private Sub Command2_Click()
  WebBrowser1.GoForward
  End Sub
  Private Sub Command3_Click()
  WebBrowser1.GoBack
  End Sub
  Private Sub Command4_Click()
  WebBrowser1.Stop
  End Sub
  Private Sub Command5_Click()
  WebBrowser1.Refresh
  End Sub
  Private Sub Command6_Click()
  CommonDialog1.ShowOpen '激活打開文件對話框選擇文件
  WebBrowser1.Navigate CommonDialog1.FileName
  WebBrowser1.Stop
  End Sub
  Private Sub Form_Load()
  Combo1.Text = ""
  Combo1.AddItem "http://www.baidu.com/"
  Combo1.AddItem "http://www.sina.com.cn/"
  Combo1.AddItem "http://user.qzone.qq.com/925519388/ "
  Combo1.Top = 0 + 40 ' 設置URL地址欄起始位置
  Combo1.Left = 0
  WebBrowser1.Top = Combo1.Top + Combo1.Height + 40 ' 設置頁面瀏覽區位置
  WebBrowser1.Left = 0
  Form_Resize
  StatusBar1.Style = sbrSimple
  ProgressBar1.ZOrder
  WebBrowser1.GoHome
  End Sub
  Private Sub Form_Resize()
  On Error GoTo a
  Combo1.Width = Form1.Width - 5150 ' URL地址欄寬度隨窗口大小調整而變化
  WebBrowser1.Width = Form1.Width - 100
  WebBrowser1.Height = Form1.Height - Combo1.Height - 1000 ' 瀏覽器高度隨窗口大小調整而變化
  ProgressBar1.Top = Me.Height - StatusBar1.Height - 330 ' 進程
  ProgressBar1.Left = 0.25 * StatusBar1.Width
  ProgressBar1.Width = 0.75 * Me.Width - 250
  Command1.Left = Form1.Width - 5100
  Command2.Left = Form1.Width - 4300
  Command3.Left = Form1.Width - 3700
  Command4.Left = Form1.Width - 3100
  Command5.Left = Form1.Width - 2500
  Command6.Left = Form1.Width - 1800 '設置6個Command按鈕水平位置隨窗口大小調整而變化
  a:
  End Sub
  Private Sub WebBrowser1_DownloadComplete()
  StatusBar1.SimpleText = "下載完成" '下載完成時狀態欄顯示“下載完成”
  ProgressBar1.Value = 0
  End Sub
  Private Sub WebBrowser1_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 WebBrowser1_TitleChange(ByVal Text As String)
  Combo1.Text = WebBrowser1.LocationURL
  End Sub
  瀏覽效果圖:
  http://b63.photo.store.qq.com/http_imgload.cgi?/rurl4_b=e64038147f12951908f2522c130c4b8fe2332b82ccb28f3706c8ccf96217a26c6baf6f73fd24a0a5defc05ae95f05250d6caceeac30b2f7876b6ac0ae53bcb1848816d91f1e59a537fa5f0383584d78a5d178759&a=63&b=63

總結

以上是生活随笔為你收集整理的用VB制作自己的IE网页浏览器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。