如何使用webBrowser控件在同一窗口中打开链接? [英] how to open link in the same window using webBrowser control?

查看:118
本文介绍了如何使用webBrowser控件在同一窗口中打开链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为webBrowser1的webBrowser控件.
在调试模式下,它具有其默认属性,并且其默认属性之一是在新窗口中打开[a]链接".我想更改代码以在同一窗口中打开该链接(而不是在默认模式下在新窗口中).
总结一下:
如何重置默认的在新窗口中打开链接"属性,并将其设置为在同一窗口中打开链接"?

而且,请原谅我,因为我不太擅长表达这些东西,我作为程序员的水平也不是很好,而且我的英语也不是那么高级!如果您听不懂,请问一下,然后我会添加详细信息.

I have a webBrowser control named webBrowser1.
When in debug mode, it have its default properties, and one of its default property is to "Open [a] link in New window". I want to change in code to open that link in the same window(not in new window as in default mode).
To summarize:
How to reset the default "Open link in New window" property, and make it "open link in the same window"?

And please, forgive me because I am not so good in expressing these things as it should, my level as programmer is not very good, and my english is not so advanced! If you will not understand something, just ask and I will add details as we go.

推荐答案

如果您使用的是WindowsForms库的WebBrowser控件,则可以使用导航属性以在WebBrowser控件中打开URL,而无需创建新窗口,如下所示
If you are using WebBrowser control of WindowsForms library, then you can use navigate property to open a URL in the WebBrowser control, without creating a new window, as below
this.webBrowser1.Navigate("http://www.CodeProject.com");


我非常怀疑您获得的属性是为IE设置的属性基本上,假设您是在窗口中运行IE,那么在全球范围内.

玩IE控件并不是真正学习编程的好方法,您最好买一本书并通过它来工作,或者编写一些可以替代计算器和记事本之类的基本应用程序.
I suspect very strongly that the properties you get, are the ones set for IE on a global basis, given that you''re running IE in a window, basically.

Playing with the IE control is not really a great way to learn programming, you''d do better to buy a book and work through it, or write basic apps that replace things like the calculator and notepad.


这篇关于如何使用webBrowser控件在同一窗口中打开链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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