VB浏览器Web与窗口大小问题,高手请进!
我用VB做了个简单的网页浏览器,用时钟控件写了web是根据窗口的大小而改变的代码,但是当我点开网页中的链接弹出另一个我浏览器窗口后,web大小便固定了,不管怎么拉伸他都只...
我用VB做了个简单的网页浏览器,用时钟控件写了web是根据窗口的大小而改变的代码,但是当我点开网页中的链接弹出另一个我浏览器窗口后,web大小便固定了,不管怎么拉伸他都只有我点击链接之前web的大小。
不知道是不是弹窗代码问题:
Dim frm2 As New Form1
frm2.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = frm2.WebBrowser1.object
frm2.Show
又或是其他?
请提供代码,谢谢!
下面是我关于问题的代码:
Private Sub Form_Load()
WebBrowser1.GoHome
End Sub
Private Sub Form_Resize()
WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight
GOButton.Left = Me.Width - 1300
Command5.Left = Me.Width - 1900
Combo2.Left = Me.Width - 5000
Text1.Left = Me.Width - 4200
GifAni1.Left = Me.Width - 700
Label1.Left = 100
Combo1.Left = Label1.Width + 20
StatusBar1.Panels(1).Width = kxllq.Width / 2.2
StatusBar1.Panels(2).Width = kxllq.Width / 10
StatusBar1.Panels(3).Width = kxllq.Width / 15
StatusBar1.Panels(5).Width = kxllq.Width / 3
ProgressBar1.Top = Me.Height - StatusBar1.Height - 370
ProgressBar1.Left = kxllq.Width / 1.6
ProgressBar1.Width = 1600
If Me.WindowState <> vbMinimized Then
If Me.Height < 6000 Then
Me.Height = 6000
End If
If Me.Width < 12000 Then
Me.Width = 12000
End If
End If
End Sub 展开
不知道是不是弹窗代码问题:
Dim frm2 As New Form1
frm2.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = frm2.WebBrowser1.object
frm2.Show
又或是其他?
请提供代码,谢谢!
下面是我关于问题的代码:
Private Sub Form_Load()
WebBrowser1.GoHome
End Sub
Private Sub Form_Resize()
WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight
GOButton.Left = Me.Width - 1300
Command5.Left = Me.Width - 1900
Combo2.Left = Me.Width - 5000
Text1.Left = Me.Width - 4200
GifAni1.Left = Me.Width - 700
Label1.Left = 100
Combo1.Left = Label1.Width + 20
StatusBar1.Panels(1).Width = kxllq.Width / 2.2
StatusBar1.Panels(2).Width = kxllq.Width / 10
StatusBar1.Panels(3).Width = kxllq.Width / 15
StatusBar1.Panels(5).Width = kxllq.Width / 3
ProgressBar1.Top = Me.Height - StatusBar1.Height - 370
ProgressBar1.Left = kxllq.Width / 1.6
ProgressBar1.Width = 1600
If Me.WindowState <> vbMinimized Then
If Me.Height < 6000 Then
Me.Height = 6000
End If
If Me.Width < 12000 Then
Me.Width = 12000
End If
End If
End Sub 展开
2个回答
展开全部
这个我刚好写过,在BeforeNavigate2事件里重设新开窗口的大小:
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.Width = 800
Me.Height = 600
End Sub
然后用动态改变WebBrowser1的大小:
Private Sub Form_Resize()
WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight
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.Width = 800
Me.Height = 600
End Sub
然后用动态改变WebBrowser1的大小:
Private Sub Form_Resize()
WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight
End Sub
更多追问追答
追问
还是一样的啊!
追答
我自己用的没问题,你的时间控件怎么写的?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询