如何用vb来导入html文件,用vb程序来实现浏览器的作用,并且能实现全屏等作用.

解决方案 »

  1.   

    WebBrowser1.Navigate "c:\test.html"
    WebBrowser1.FullScreen
      

  2.   

    在vb用中什么来做,是建立ActivateX控件来做?
      

  3.   

    部件箱添加
    microsoft internet controls
      

  4.   

    回复人: online(龙卷风V2.0--再战江湖) (  
    我添加了
    WebBrowser1.Navigate "c:\test.html"
    WebBrowser1.FullScreen
    进去,可是执行的时候抛出"属性使用无效"的错误
    这是为什么啊
    下面是我的代码
    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
        Combo1.Text = "http://" + Combo1.Text
        End If
        WebBrowser1.Navigate Combo1.Text
        WebBrowser1.FullScreen
        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 Combo1_Click()
        WebBrowser1.Navigate Combo1.Text
    End Sub
    Private Sub Form_Load()
        Combo1.Text = ""
        Combo1.Top = 0
        Combo1.Left = 0
        WebBrowser1.Top = Combo1.Top + Combo1.Height
        WebBrowser1.Left = 0
        Form_Resize
        StatusBar1.Style = sbrSimple
        ProgressBar1.ZOrder
        End Sub
    Private Sub Form_Resize()
        On Error GoTo a
        Combo1.Width = Form1.Width - 100
        WebBrowser1.Width = Combo1.Width
        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
    a:
    End Sub
    Private Sub WebBrowser1_DownloadBegin()
        StatusBar1.SimpleText = "载入中…"
        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
      

  5.   

    Option Explicit
    Dim strCommand As String
    Dim strWebPage As StringPrivate Sub Command1_Click()Winsock1.RemoteHost = "202.103.176.81" '返回或设置远程计算机,控件向它发送数据或从它那里接收数据。既可提供主机名,比如 "FTP://ftp.microsoft.com",也可提供点格式下的 IP 地址字符串,比如 "100.0.1.1"。
    Winsock1.RemotePort = 80 '返回或设置要连接的远程端口号
    Winsock1.Connect '返回与远程计算机的连接。
    End SubPrivate Sub Winsock1_Connect() '当一个 Connect 操作完成时发生。
    On Error Resume Next
    strWebPage = "http://202.103.176.81/crun/yingzi007/code_1.asp"
    strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf 'GET 为FTP命令
    strCommand = strCommand + "Accept: */*" + vbCrLf      '这句可以不要
    strCommand = strCommand + "Accept: text/html" + vbCrLf '这句可以不要
    strCommand = strCommand + vbCrLf      '记住一定要加上vbCrLfDebug.Print strCommandWinsock1.SendData strCommand  ''给远程计算机发送数据End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long) '当新数据到达时产生该事件
    On Error Resume Next   '在错误处理程序结束后,恢复原有的运行
    Dim webData As String
    Winsock1.GetData webData, vbString '检取当前的数据块
    Text1.Text = Text1.Text + webData
    End Sub