WinForms WebBrowser控件中的颜色未更新 [英] Color is not been updating in WinForms WebBrowser control

查看:77
本文介绍了WinForms WebBrowser控件中的颜色未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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


Below is the code I am using for style sheet. The code with background: 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 simply  wrapper round internet explorer, not include all functions of IE, after all , IE is a complete product and webbrowser just a control.

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

By default, WebBrowser control in IE7 compatibility Mode 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控件中的颜色未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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