VB WebBrowser 点击链接时不弹出IE,而在WebBrowser里打开链接
发布网友
发布时间:2024-10-16 02:00
我来回答
共2个回答
热心网友
时间:2024-10-16 15:25
可以弄个WebBrowser1控件数组, WebBrowser1(0) WebBrowser1(1)
设计的时候重叠在一起,而后当打开新窗口时,原窗口隐藏,用对应的另一个窗口打开即可
由于两个窗口重叠在了一起,用户也无法觉察到
Dim iNum As Integer
Private Sub Command1_Click()
WebBrowser1(iNum).Navigate "http://www.baidu.com"
End Sub
Private Sub Form_Load()
ShowWeb iNum
End Sub
Private Sub WebBrowser1_NewWindow2(Index As Integer, ppDisp As Object, Cancel As Boolean)
ShowWeb 1 - Index
Set ppDisp = WebBrowser1(1 - Index).Object
End Sub
Private Sub ShowWeb(ByVal i As Integer)
WebBrowser1(i).Visible = True
WebBrowser1(1 - i).Visible = False
End Sub
热心网友
时间:2024-10-16 15:26
Private Sub Command1_Click()
WebBrowser1.Navigate "www.baidu.com"
End Sub
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
WebBrowser1.Navigate URL
End Sub