我如何开发一个Win窗体作为Web浏览器

我如何开发一个Win窗体作为Web浏览器

问题描述:

大家好



我想开发一个Windows窗体应用程序作为网络浏览器。

我使用下面的代码:



Hi everybody

I want develop a Windows form application as web browser.
I use from bellow code:

WebRequest request = WebRequest.Create(this.Url.Text);
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);

this.WebBrowser.DocumentText = reader.ReadToEnd();
                
reader.Close();





但我有错误。

此代码只创建请求,而大部分网站都有多个Url因此我必须在网站上创建任何Url请求。



如何加载整个网站文件和方向???



请帮帮我



谢谢很多



But I have an error.
this code only create a request while most of web site have many Url therefore I must create a request for any Url in website.

How I can load whole of web site files and direction???

Please help me

Thank a lot

请参考以下链接:

C#中的Web浏览器 [ ^ ]

http://www.dotnetperls.com/ webbrowser [ ^ ]

http://www.c-sharpcorner.com/uploadfile/kapilsoni88/web- browser-in-C-Sharp / [ ^ ]





--Amit
Refer the links below:
Web Browser in C#[^]
http://www.dotnetperls.com/webbrowser[^]
http://www.c-sharpcorner.com/uploadfile/kapilsoni88/web-browser-in-C-Sharp/[^]


--Amit


hi,



查看以下链接。

WebBrowser控件 [ ^ ]

在Windows窗体应用程序上使用的最佳Web浏览器控件是什么? [ ^ ]



hope它会有所帮助。


check below links.
WebBrowser Control[^]
What is the best web browser control to use on Windows Form Application?[^]

hope it helps.


大家好。



我通过以下代码解决了我的问题:



Hi every body

I solved my problem by bellow code:

private WebBrowser GetCurrentBrowser()
{
    return (WebBrowser)TabControl.SelectedTab.Controls[0];
}

private void GoPage()
{
    GetCurrentBrowser().Navigate(UrlTextBox.Text);
}





非常感谢



Thanks a lot