高分需求一vb制作得简单浏览器源代码
答案:3 悬赏:30 手机版
解决时间 2021-02-20 18:53
- 提问者网友:杀生予夺
- 2021-02-20 11:19
高分需求一vb制作得简单浏览器源代码
最佳答案
- 五星知识达人网友:鸠书
- 2021-02-20 12:18
内部嵌一个webbrowser控件就是了
Private Sub BackButton_Click()
'返回上一个页面
WebBrowser1.GoBack
End Sub
Private Sub Form_Load()
'程序装入后进入IE设定的起始页
WebBrowser1.GoHome
End Sub
Private Sub Form_Resize()
'改变窗口大小后同时改变控件的大小
WebBrowser1.Width = Form1.ScaleWidth
WebBrowser1.Height = Form1.ScaleHeight - 900
End Sub
Private Sub ForwardButton_Click()
'进入下一个页面
WebBrowser1.GoForward
End Sub
Private Sub GoButton_Click()
'浏览输入的页面
WebBrowser1.Navigate (Text1.Text)
End Sub
Private Sub StopButton_Click()
'停止浏览
WebBrowser1.Stop
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'浏览输入的页面
If KeyAscii = 13 Then
WebBrowser1.Navigate (Text1.Text)
End If
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
'将当前显示的页面的URL地址显示在Text1上
Text1.Text = URL
End Sub
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
'窗口的标题栏中显示当前页面装入情况
Me.Caption = Text: Text1 = Me.Caption
End Sub
Private Sub BackButton_Click()
'返回上一个页面
WebBrowser1.GoBack
End Sub
Private Sub Form_Load()
'程序装入后进入IE设定的起始页
WebBrowser1.GoHome
End Sub
Private Sub Form_Resize()
'改变窗口大小后同时改变控件的大小
WebBrowser1.Width = Form1.ScaleWidth
WebBrowser1.Height = Form1.ScaleHeight - 900
End Sub
Private Sub ForwardButton_Click()
'进入下一个页面
WebBrowser1.GoForward
End Sub
Private Sub GoButton_Click()
'浏览输入的页面
WebBrowser1.Navigate (Text1.Text)
End Sub
Private Sub StopButton_Click()
'停止浏览
WebBrowser1.Stop
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'浏览输入的页面
If KeyAscii = 13 Then
WebBrowser1.Navigate (Text1.Text)
End If
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
'将当前显示的页面的URL地址显示在Text1上
Text1.Text = URL
End Sub
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
'窗口的标题栏中显示当前页面装入情况
Me.Caption = Text: Text1 = Me.Caption
End Sub
全部回答
- 1楼网友:笑迎怀羞
- 2021-02-20 14:02
private sub command1_click() webbrowser1.navigate text1 'text1输入完整的网址 timer1.interval = text2 'text2输入数字,不要超过65535 timer1.enabled = true end sub private sub command2_click() timer1.enabled = false '停止 end sub private sub timer1_timer() webbrowser1.navigate text1 end sub 这个是比较简单的
- 2楼网友:雾月
- 2021-02-20 13:24
Private Sub Command1_Click()
If Text1.Text <> "" Then
WebBrowser1.Navigate2 Text1.Text
WebBrowser1.Visible = True
Text2.Visible = False
End If
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯