VB 2003中的Web浏览器控件 [英] Web browser control in VB 2003

查看:374
本文介绍了VB 2003中的Web浏览器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通往启蒙之路的又一步,即创造一个用户界面。我已经为表单添加了一个webbrowser控件,我希望它能填充表单的空间

。玩弄对接,左,顶部,宽度,高度

坚决拒绝这样做,因为它仍然停靠在左上角附近

100,100表格内,大小约300,250。


如何使用wb控件填充winform?


进一步阅读,它看起来像升级的另一个论点到2005年,

将webbrowser作为标准配置。是否有更好的表现在

2005?

-

干杯,ymt。

解决方案

嗨Yuk Tang,


如果你想让任何控件填满所有可用空间,请设置它的码头

属性为填充。这包括WebBrowser控件。


虽然升级到VS 2005可能有很多原因,但这确实不是其中之一,因为这不是其中之一该功能在VS 2003中有效。


HTH,


问候,


Cerebrus。


" Cerebrus" < ZO ***** @ sify.com>在新闻中写道:1144019961.881852.63380

@ t31g2000cwb.googlegroups.com:


您好Yuk Tang,

如果您想要任何控制以填充所有可用空间,将其Dock/属性设置为填充。这包括WebBrowser控件。

虽然升级到VS 2005可能有很多原因,但这似乎不是其中之一,因为该功能在VS 2003中有效。 / blockquote>


这里是实例化面板中表单的代码,

,如前面一个帖子所示。在显示

第一个子表单之前有一段时间的延迟,但我确定我会到达底部。


Form1有2个面板,Panel1和Panel2。尽管有一个恼人的延迟(该死的编译器),Form2令人满意地打开了Panel1相当

。 Form3

包含一个webbrowser控件打开到Panel2。网页浏览器已经停靠在设计时填写了b
,但我已经停留在代码中以确保

确定。


Private Sub Panel1_Paint(ByVal sender As System.Object,ByVal e As

System.Windows.Forms.PaintEventArgs)Handles Panel1.Paint

Dim f As New Form2

f.TopLevel = False

f2.ControlBox = False

f2.Text =""

f .WindowState = FormWindowState.Maximized

Me.Panel1.Controls.Add(f)

f.Show()

Dim f2 As New Form3

f2.TopLevel = False

f2.ControlBox = False

f2.Text =""

f2.WindowState = FormWindowState.Maximized

Me.Panel2.Controls.Add(f2)

f2.AxWebBrowser1.Dock = DockStyle.Fill

f2.Show()

f2.AxWebBrowser1.Navigate2(&C:\Documents and Settings \Y Tang \ Myy

Documents\Visual Studio Projects \\ \\ WindowsApplication6 \ bin \ temp
\ notfound.htm")

End Sub


要了解发生了什么,我已经贴了4个标签在Form3上告诉我

AxWebBrowser1的大小和行踪。当Form1加载

最大化时,它告诉我AxWebBrowser1是0,0,大小292,273。

尝试拉伸和收缩AxWebBrowser1告诉我

最大化的大小应该是809,690,而

AxWebBrowser1在表格中的位置并不重要,Top和Left保持为0,0。此外,

AxWebBrowser1在不同的时候(仅点击exe)运行时跳转到表单,偏移高达150,150

从左上角开始告诉我,顶部和左边都是0,0。


奇怪的是,在每次连续运行exe时,它都是

进一步向形式的中心跳跃,直到它被抵消为

多达150,150。一旦达到该限制,下一次将看到

它会跳回到32,32左右。尽管我的眼睛告诉我,它一直告诉我它在0,0,




我试过设置顶部和在设置Dock之前离开,我已经尝试在显示表单之前设置

所有,我已经尝试在显示

表单后设置它们。没有快乐。

-

干杯,ymt。


Yuk,


webbrower .Net 2005没有使用2003年使用的axwebbrowswer

的东西


如果你动态地实例化webbrowsers,你可以直接看到。


我从来没有在最后一个选项中成功。


对于定位webbrowser在我看来最好使用状态栏

停靠在底部的一个工具栏顶部,浏览器停靠

已满。看看ZOrder。 (它们放置的顺序

(添加)在表格上)。这就是他们填写的方式。


我希望这会有所帮助,


Cor

" Yuk Tang" <ジ******** @ yahoo.com> schreef in bericht

news:Xn ******************************* @ 130.133.1.4。 ..

通往启蒙之路的又一步,即生成UI。我已经在表单中添加了一个webbrowser控件,我希望它能填充表单的空间。在对接,左,顶部,宽度,高度四处玩耍时坚决拒绝这样做,因为它仍保持在左上方位于窗体内的100,100左右,大小约为300,250。

如何使用wb控件填充winform?

进一步阅读,它看起来像升级到2005年的另一个论点,
以webbrowser为标准。在2005年的表现是否更好?

-
干杯,ymt。



Another step on the road to enlightenment, aka producing a UI. I''ve
added a webbrowser control to a form, and I want it to fill the space
of the form. Playing around with docking, left, top, width, height
resolutely refuses to do this, as it remains docked top-left at around
100,100 within the form, with a size of approx 300,250.

How do I fill the winform with the wb control?

Reading further, it looks like another argument for upgrading to 2005,
which has the webbrowser as standard. Is it any better behaved in
2005?
--
Cheers, ymt.

解决方案

Hi Yuk Tang,

If you want any control to fill all available space, set it''s Dock
property to "Fill". This includes the WebBrowser control.

Although, there may be many reasons to upgrade to VS 2005, this does
not seem to be one of them, since the functionality works in VS 2003.

HTH,

Regards,

Cerebrus.


"Cerebrus" <zo*****@sify.com> wrote in news:1144019961.881852.63380
@t31g2000cwb.googlegroups.com:


Hi Yuk Tang,

If you want any control to fill all available space, set it''s Dock
property to "Fill". This includes the WebBrowser control.

Although, there may be many reasons to upgrade to VS 2005, this does
not seem to be one of them, since the functionality works in VS 2003.



Here''s the bit of code that instantiates the forms within the panels,
as suggested in an earlier thread. There''s quite a delay before the
first subform is shown, but I''m sure I''ll get to the bottom of that.

Form1 has 2 panels, Panel1 and Panel2. Form2 opens into Panel1 quite
satisfactorily, although with an annoying delay (damn compiler). Form3
containing a webbrowser control opens into Panel2. The webbrowser is
already docked to fill at design time, but I''ve stuck in the code to
make sure.

Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Dim f As New Form2
f.TopLevel = False
f2.ControlBox = False
f2.Text = ""
f.WindowState = FormWindowState.Maximized
Me.Panel1.Controls.Add(f)
f.Show()
Dim f2 As New Form3
f2.TopLevel = False
f2.ControlBox = False
f2.Text = ""
f2.WindowState = FormWindowState.Maximized
Me.Panel2.Controls.Add(f2)
f2.AxWebBrowser1.Dock = DockStyle.Fill
f2.Show()
f2.AxWebBrowser1.Navigate2("C:\Documents and Settings\Y Tang\My
Documents\Visual Studio Projects\WindowsApplication6\bin\temp
\notfound.htm")
End Sub

To find out what''s happening, I''ve stuck 4 labels on Form3 to tell me
the size and whereabouts of AxWebBrowser1. When the Form1 loads
maximised, it tells me that AxWebBrowser1 is at 0,0, size 292,273.
Experimenting with stretching and shrinking AxWebBrowser1 tells me the
maximised size should be 809,690, while it does not matter where
AxWebBrowser1 is on the form, Top and Left remain 0,0. Also,
AxWebBrowser1 jumps around the form when I run it on different
occasions (just clicking on the exe), offset by anything up to 150,150
from top left and still telling me that top and left are 0,0.

The strange thing is that on each successive running of the exe, it
jumps further towards the centre of the form, until it''s offset by as
much as 150,150. Once it''s reached that limit, the next time will see
it jump back to around 32,32. All the while it tells me it''s at 0,0,
despite what my eyes tell me.

I''ve tried setting top and left before setting Dock, I''ve tried setting
them all before showing the form, I''ve tried setting them after showing
the form. No joy.
--
Cheers, ymt.


Yuk,

The webbrower .Net 2005 has not the anoying things from the axwebbrowswer
used in 2003

This you see directly if you instance the webbrowsers dynamicly.

I never succeeded in the last option.

For positioning a webbrowser is in my opinion the best to use a statusbar
docked at the bottom a kind of toolbar at the top and the browser docked
full. Have a look on that for the ZOrder. (The sequence they are placed
(add) on the form). That makes how they fill in.

I hope this helps,

Cor
"Yuk Tang" <ji********@yahoo.com> schreef in bericht
news:Xn*******************************@130.133.1.4 ...

Another step on the road to enlightenment, aka producing a UI. I''ve
added a webbrowser control to a form, and I want it to fill the space
of the form. Playing around with docking, left, top, width, height
resolutely refuses to do this, as it remains docked top-left at around
100,100 within the form, with a size of approx 300,250.

How do I fill the winform with the wb control?

Reading further, it looks like another argument for upgrading to 2005,
which has the webbrowser as standard. Is it any better behaved in
2005?
--
Cheers, ymt.



这篇关于VB 2003中的Web浏览器控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆