怎么用VB制作一个浏览器啊
怎么用VB制作一个浏览器啊?就是一打开就访问制定网页的啊。。。我要源码大大。。。专门访问我的网页的。。。...
怎么用VB制作一个浏览器啊?就是一打开就访问制定网页的啊。。。
我要源码大大。。。专门访问我的网页的。。。 展开
我要源码大大。。。专门访问我的网页的。。。 展开
2个回答
展开全部
这里是简单的代码,你要做比较完整的浏览器自己可以添加些功能
Option Explicit
Dim int_i As Integer '当前页面在历史中的个数
Dim intSum As Integer '总的浏览过的页面数
Private Sub Command1_Click()
'链接网页
Me.WebBrowser1.Navigate (Me.Text1.Text) '这里连接的网站地址是文本框输入的地址,要专门访问你的网页将这一句放入你的窗体装载事件里面,并先设置me.text1.text="这里填写要专门访问的网页"
intSum = intSum + 1
int_i = intSum
Me.Command3.Enabled = False
If intSum > 1 Then
Me.Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Me.WebBrowser1.GoBack
int_i = int_i - 1
Me.Command3.Enabled = True
If int_i = 1 Then
Me.Command2.Enabled = False
End If
End Sub
Private Sub Command3_Click()
Me.WebBrowser1.GoForward
int_i = int_i + 1
Me.Command2.Enabled = True
If int_i = intSum Then
Me.Command3.Enabled = False
End If
End Sub
Private Sub Command4_Click()
Me.WebBrowser1.Stop
End Sub
Private Sub Form_Load()
Me.WebBrowser1.GoHome
Me.WindowState = 2
Me.Command4.Enabled = False
int_i = 1
intSum = 1
Me.Command2.Enabled = False
Me.Command3.Enabled = False
End Sub
Private Sub Form_Resize()
Me.WebBrowser1.Width = Me.ScaleWidth - 200
Me.WebBrowser1.Height = Me.ScaleHeight - 600
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
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)
Me.Command4.Enabled = True
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Me.Command4.Enabled = False
End Sub
Option Explicit
Dim int_i As Integer '当前页面在历史中的个数
Dim intSum As Integer '总的浏览过的页面数
Private Sub Command1_Click()
'链接网页
Me.WebBrowser1.Navigate (Me.Text1.Text) '这里连接的网站地址是文本框输入的地址,要专门访问你的网页将这一句放入你的窗体装载事件里面,并先设置me.text1.text="这里填写要专门访问的网页"
intSum = intSum + 1
int_i = intSum
Me.Command3.Enabled = False
If intSum > 1 Then
Me.Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Me.WebBrowser1.GoBack
int_i = int_i - 1
Me.Command3.Enabled = True
If int_i = 1 Then
Me.Command2.Enabled = False
End If
End Sub
Private Sub Command3_Click()
Me.WebBrowser1.GoForward
int_i = int_i + 1
Me.Command2.Enabled = True
If int_i = intSum Then
Me.Command3.Enabled = False
End If
End Sub
Private Sub Command4_Click()
Me.WebBrowser1.Stop
End Sub
Private Sub Form_Load()
Me.WebBrowser1.GoHome
Me.WindowState = 2
Me.Command4.Enabled = False
int_i = 1
intSum = 1
Me.Command2.Enabled = False
Me.Command3.Enabled = False
End Sub
Private Sub Form_Resize()
Me.WebBrowser1.Width = Me.ScaleWidth - 200
Me.WebBrowser1.Height = Me.ScaleHeight - 600
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
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)
Me.Command4.Enabled = True
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Me.Command4.Enabled = False
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |