什么引擎呈现WebBrowser控件?

时间:2016-07-06 17:06:36

标签: html vb.net webbrowser-control

我目前在下面创建的VB.NET项目中有一个WebBrowser控件:

Private Sub SomeSubToPrintHTMLViaWebBrowser()

   ' strDocument is the giant blob of HTML text that can be seen in the jsFiddle linked later in the question.

    Dim webBrowserHidden As New WebBrowser

    AddHandler webBrowserHidden.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument)

    webBrowserHidden.DocumentText = strDocument

End Sub

然而,当我使用WebBrowser的.Print.ShowPrintDialog方法时,即使我在HTML,Edge,Chrome或IE中加载HTML编码作为网页,页面也会出现格式错误Firefox,它工作得非常好。编码也被验证为"正确"通过W3C在线验证器。

所以我想知道的是,WebBrowser使用什么引擎来渲染页面?

以下是我尝试运行的HTML / CSS编码

https://jsfiddle.net/et1t2kh5/

1 个答案:

答案 0 :(得分:1)

这可能是因为WebBrowser控件正在模拟旧版本的IE。 不幸的是,没有简单的解决方法,解决方法要求您修改注册表。

使用注册表编辑器(regedit.exe)导航到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

添加一个新的DWORD条目,其名称将是应用程序可执行文件的名称,然后将值设置为2af8(十六进制)或11000(十进制)。

这将强制WebBrowser控件使用IE11的渲染引擎。

有关详细信息,请参阅以下链接:Internet Feature Controls (B..C)

相关问题