无法使用System.Windows.Form.WebBrowser控件呈现HTML字符串 [英] Cant render an HTML string with System.Windows.Form.WebBrowser control

查看:92
本文介绍了无法使用System.Windows.Form.WebBrowser控件呈现HTML字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要一个HTML渲染器,它可以渲染包含HTML标签的字符串.但是System.Windows.Form.WebBrowser不能正确执行此操作!例如看下面的代码:

Hi everybody,

I need an HTML renderer which can render a string containing HTML tags; but a System.Windows.Form.WebBrowser doesn''t do that correctly! For example take a look at this code:

WebBrowser wBrowser1 = new WebBrowser ();
wBroser.1.Navigated += new WebBrowserNavigatedEventHandler(wBroser1_Navigated); 

WebBrowser wBrowser2 = new WebBrowser ();

wBrowser1.Navigate("www.codeproject.com");

private void wBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{ 
     wBrowser2.DocumentText = wBrowser1.DocumentText;
}



当我做这样的事情时,我希望看到的东西就像我在Internet浏览器中看到的一样,但是您可以尝试一下,看看有什么不同.
当然,我不能直接从wBrowser2导航url,因为我要在第二个WebBrowser控件中呈现它们之前操纵html标记.

我只需要一个HTML渲染器,就可以使用System.Windows.Form.WebBrowser做到这一点的最简单方法,但是它不起作用,因此我不坚持使用此控件.我只需要渲染一个带有HTML标签的网页,就像任何网络浏览器一样!

谢谢.



When I do something like that I expect to see something like what I see in my internet browser, but you can try it and see the difference.
And of course I can''t navigate a url directly from wBrowser2 , because I''m manipulating the html tags before rendering them in second WebBrowser control.

I just need an HTML renderer and I tought using System.Windows.Form.WebBrowser is the simplest way to do that, but it''s not working, so I''m not insisting on using this control. I just need to render a web page with its HTML tags, as any web browser does!

Thanks.

推荐答案

这里是一个免费的HTML渲染器控件. http://htmlrenderer. codeplex.com/ [ ^ ]
Here is a free HTML renderer control.http://htmlrenderer.codeplex.com/[^]


我尝试过并且非常喜欢的渲染器是这个:您将要使用的专业HTML渲染器 [ ^ ].也许这真的是"您将要使用的专业HTML渲染器"吗?

—SA
The renderer I tried and liked very much is this one: A Professional HTML Renderer You Will Use[^]. May be this is really "A Professional HTML Renderer You Will Use"?

—SA


这篇关于无法使用System.Windows.Form.WebBrowser控件呈现HTML字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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