vb如何动态添加webbrowers控件
vb如何动态添加webbrowers控件,动态删除webbrowers控件。请给出源码,谢谢。...
vb如何动态添加webbrowers控件,动态删除webbrowers控件。请给出源码,谢谢。
展开
2个回答
展开全部
Option Explicit
Private WithEvents web1 As WebBrowser
Private Sub Command1_Click() '创建
Set web1 = Me.Controls.Add("SHELL.EXPLORER.2", "web1", Me)
web1.Visible = True
web1.Move 0, 0, 1000, 1000
web1.Navigate "http://community.csdn.net/Expert/topic/3273/3273662.xml?temp=.6609766", 0
End Sub
Private Sub Command2_Click() '移除
Form1.Controls.Remove "web1"
End Sub
Private WithEvents web1 As WebBrowser
Private Sub Command1_Click() '创建
Set web1 = Me.Controls.Add("SHELL.EXPLORER.2", "web1", Me)
web1.Visible = True
web1.Move 0, 0, 1000, 1000
web1.Navigate "http://community.csdn.net/Expert/topic/3273/3273662.xml?temp=.6609766", 0
End Sub
Private Sub Command2_Click() '移除
Form1.Controls.Remove "web1"
End Sub
展开全部
做多选项卡浏览器用到的,可以添加很多个WebBrowser
你画一个command1和command2
再画一个webbrowser1,设置index属性为0,记得,一定要设置
================代码===================
Dim colBrowser As New Collection
Function addBrowser() As Long
Dim cWb As WebBrowser, i As Long
i = colBrowser.Count
Load WebBrowser1(i)
Set cWb = WebBrowser1(i)
cWb.Visible = True
cWb.ZOrder 0
cWb.Navigate "http://www.hao123.com"
colBrowser.Add cWb
End Function
Sub remBrowser()
Dim cWb As WebBrowser, i
i = colBrowser.Count
If i < 2 Then Exit Sub
Set cWb = colBrowser(i)
Unload cWb
colBrowser.Remove i
End Sub
Private Sub Form_Load()
colBrowser.Add WebBrowser1(0)
End Sub
Private Sub Command1_Click()
addBrowser
End Sub
Private Sub Command2_Click()
remBrowser
End Sub
================代码===================
觉得回答得好就再加点分吧,谢谢!
你画一个command1和command2
再画一个webbrowser1,设置index属性为0,记得,一定要设置
================代码===================
Dim colBrowser As New Collection
Function addBrowser() As Long
Dim cWb As WebBrowser, i As Long
i = colBrowser.Count
Load WebBrowser1(i)
Set cWb = WebBrowser1(i)
cWb.Visible = True
cWb.ZOrder 0
cWb.Navigate "http://www.hao123.com"
colBrowser.Add cWb
End Function
Sub remBrowser()
Dim cWb As WebBrowser, i
i = colBrowser.Count
If i < 2 Then Exit Sub
Set cWb = colBrowser(i)
Unload cWb
colBrowser.Remove i
End Sub
Private Sub Form_Load()
colBrowser.Add WebBrowser1(0)
End Sub
Private Sub Command1_Click()
addBrowser
End Sub
Private Sub Command2_Click()
remBrowser
End Sub
================代码===================
觉得回答得好就再加点分吧,谢谢!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询