在WebBrowser WPF中渲染Bootstrap [英] Rendering Bootstrap in WebBrowser WPF
问题描述
早上好,
我使用WebBrowser控件来渲染带有引导样式的网页,但结果不正确。
文本框未对齐且图片不可见。
任何人都知道原因?
如何解决此问题?
谢谢大家的贡献,
Lucrezia
据我所知,默认情况下,WebBrowser控件在兼容性视图模式下运行,兼容性视图模式基本上是文档模式7默认的IE 7模式不识别很多o f这些设置导致糟糕的渲染模式。 这个
应该是原因问题。
有几种方法可以覆盖默认的渲染行为:
- 使用IE
X-UA兼容
Meta标题- 使用特定于应用程序的
FEATURE_BROWSER_EMULATION
注册表键
如使用MS edge或IE 11进行渲染,可以将HTML页面元标记设置如下。
< meta http-equiv =" X-UA-Compatible"含量=" IE =边缘" />
< meta http-equiv =" X-UA-Compatible"含量=" IE = 11" />
您可以在注册表上设置FEATURE_BROWSER EMULATION以修改默认渲染模式。
HKEY_LOCAL_MACHINE(或HKEY_CURRENT_USER)
SOFTWARE
Microsoft
Internet Explorer
Main
FeatureControl
FEATURE_BROWSER_EMULATION
contoso.exe =(DWORD)0000900所以我建议 您尝试设置webbrowser兼容模式。
请检查以下主题:
https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control -Specifying-the-IE-Version
https://blogs.msdn.microsoft.com/patricka/2015/01/12/controlling-webbrowser-control-compatibility/
注意:此响应包含对第三方万维网站点的引用。 Microsoft提供此信息是为了方便您。 Microsoft不控制这些网站,也未测试在这些网站上找到的任何软件或信息;因此,
Microsoft不能就其中发现的任何软件或信息的质量,安全性或适用性做出任何陈述。使用互联网上的任何软件都存在固有的危险,微软提醒您在从互联网上检索任何软件之前确保您完全了解风险。
最诚挚的问候,
Good morning,
I use WebBrowser control to render web page with bootstrap style, but the result isn't correct.
Textboxes aren't aligned and the images are not visible.
Anyone know the reason?
How do I fix this problem?
Thank you all for your contribution,
Lucrezia
Hi,
As far as I know,by default, the WebBrowser control runs in compatibility view mode, Compatibility view mode is basically document mode 7. Default IE 7 mode doesn't recognize many of these settings resulting in a terrible render mode.This should be the cause of the problem.
There are a couple of ways to override the default rendering behavior:
- Using the IE
X-UA-Compatible
Meta header- Using Application specific
FEATURE_BROWSER_EMULATION
Registry KeysSuch as use MS edge or IE 11 to render, you can set HTML pages meta tag as below.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />You can set FEATURE_BROWSER EMULATION on Registry to modify default render mode.
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) SOFTWARE Microsoft Internet Explorer Main FeatureControl FEATURE_BROWSER_EMULATION contoso.exe = (DWORD) 0000900So I suggest you try to set webbrowser compatibility mode.
Please check below threads:
https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
https://blogs.msdn.microsoft.com/patricka/2015/01/12/controlling-webbrowser-control-compatibility/
Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Best Regards,
这篇关于在WebBrowser WPF中渲染Bootstrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!