WinForms WebBrowser控件中的颜色未更新

编程入门 行业动态 更新时间:2024-10-25 18:28:24
本文介绍了WinForms WebBrowser控件中的颜色未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图在WinForms中托管一个html文件WebBrowser控件,但我看不到标题颜色正在更新。请参考下图。如果我在Internet Explorer中打开,颜色显示正常但在WebBrowser控件中托管时没有更新。

https:// i。 stack.imgur/ThP0N.png

i.stack.imgur/ThP0N.png

下面是我用于样式表的代码。该代码包含 背景:线性渐变(到底部,#dfecff 0%,#b4d5ff 100%); 尚未在WebBrowser控件中更新。为什么会发生这种情况?是否可以修复此问题?

Below is the code I am using for style sheet. The code withbackground: linear-gradient(to bottom, #dfecff 0%, #b4d5ff 100%);is not been updated in WebBrowser control. Why this is happeneing? and is it possible to fix this issue?

body { background-color: #777777; font-family: Verdana, Geneva, sans-serif; font-size: 9pt; } table { font-family: Verdana, Geneva, sans-serif; font-size: 9pt; background-color: #FFF; } h1, h2 { background: #b4d5ff; background: linear-gradient(to bottom, #dfecff 0%, #b4d5ff 100%); }

下面是我用于测试的html代码。

Below is the html code that I have used for testing.

<html><body><head> <link rel="stylesheet" href="test.css" type="text/css" /></head> <h2>Testing</h2> <table> <tr><td>text1</td></tr> <tr><td>text2</td></tr> <tr><td>text3</td></tr> <tr><td>text4</td></tr> </table> </body> </html>

任何帮助都将不胜感激。

Any help would be appreciated.

问候,

Anish

Anish

body { background-color: #777777; font-family: Verdana, Geneva, sans-serif; font-size: 9pt; } table { font-family: Verdana, Geneva, sans-serif; font-size: 9pt; background-color: #FFF; } h1, h2 { background: #b4d5ff; background: linear-gradient(to bottom, #dfecff 0%, #b4d5ff 100%); }

下面是我用于测试的html代码。

Below is the html code that I have used for testing.

<html><body><head> <link rel="stylesheet" href="test.css" type="text/css" /></head> <h2>Testing</h2> <table> <tr><td>text1</td></tr> <tr><td>text2</td></tr> <tr><td>text3</td></tr> <tr><td>text4</td></tr> </table> </body> </html>

任何帮助都会受到赞赏。

Any help would be appreciated.

问候,Anish

Regards, Anish

推荐答案

嗨AnishGeorge,

Hi AnishGeorge,

据我所知,webbrowser控件是一个简单的包装器圆形Internet浏览器,不包括IE的所有功能,毕竟IE是一个完整的产品和 web浏览器只是一个控件。

As far as I konw, The webbrowser control is a simplywrapper round internet explorer, not include all functions of IE, after all , IE is a complete product andwebbrowser just a control.

默认情况下,默认情况下,WebBrowser控件在IE7兼容性模式下,可能会出现某些功能可以显示在当前IE中但不能显示在WebBrowser中。 所以你应该通知网页以 IE的适当模式显示。

By default, WebBrowser control in IE7 compatibilityMode by default, it maybe appear that some features can be displayed in your current IE but not in the WebBrowser. So you should inform the web page to display in the appropriate mode of IE.

有两种方法可以做到这一点。以IE11为例,

Two ways can do this. Take IE11 as an example,

1.将元标记添加到网页的头部。

1.Add a meta tag to the head of web page.

<meta http-equiv="X-UA-Compatible" content="IE=11" />

2.尝试通过注册表项更改Internet Explorer的默认模拟模式(FEATURE_BROWSER_EMULATION )。见 互联网功能控制(B..C)

2.Try to alter the default emulation mode for Internet Explorer by the registry key(FEATURE_BROWSER_EMULATION). See Internet Feature Controls (B..C)

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) SOFTWARE Microsoft Internet Explorer Main FeatureControl FEATURE_BROWSER_EMULATION YourApp.exe = (DWORD) 000011001

希望有所帮助。

祝你好运,

Bob

更多推荐

WinForms WebBrowser控件中的颜色未更新

本文发布于:2023-11-10 06:34:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574622.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   颜色   WinForms   WebBrowser

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!