我在我的 winforms 应用程序中使用 WebBrowser 控件和 Smooth Div Scroll 来呈现 html 选取框.我下载了示例并添加了
I use the WebBrowser control and Smooth Div Scroll in my winforms application to render a html marquee. I downloaded the sample and added
autoScrollingInterval: 3
到
$("div#makeMeScrollable").smoothDivScroll({
autoScrollingMode: "onStart"
});
让它移动得更快.当我在 IE 中打开示例时,它工作得很好,但是当我使用 WebBrowser 控件并调用导航方法时,滚动条的移动速度要慢得多.
to make it move faster. When I open the sample in IE it works just fine but when I use the WebBrowser control and call the navigate method the scroller moves much slower.
是什么导致了这个问题?
What is causing this problem?
据我了解,您正在处理的问题是 IE 7 标准模式下的 WebBrowser Control 呈现和您使用的实际 WebBrowser 的版本控制问题IE 是 IE 8 或 IE 9,它在那里工作,但你的 JQuery/JavaScript 或 CSS 包含在 IE 7 中不起作用.
As I understand it, the issue you are dealing with is a versioning issue with the WebBrowser Control rendering in IE 7 Standard Mode and the actual WebBrowser you are using in IE is either IE 8 or IE 9, and it works there, yet your JQuery/JavaScript or CSS inclusions are not working in IE 7.
让我直截了当地告诉你.默认渲染引擎开启webbrowser 控件是固定的,以确保在所有的兼容性平台.
Let me tell you this straight up. The default rendering engine on the webbrowser control is fixed to ensure compatibility across all platforms.
基本上,如果你安装的浏览器是 IE 7 - IE 9,那么使用的渲染引擎仅 IE 7.0(默认).
Basically, if you're installed browser is IE 7 - IE 9, then the rendering engine used is IE 7.0 only (by default).
但是,如果您安装的 IE 版本是 IE 6 或更低,那么使用的渲染引擎是 IE 4.0(不是开玩笑),当然除非你否则设置它.
If, however, your installed IE version is IE 6 or below, then the rendering engine used is IE 4.0 (not kidding), unless of course you set it otherwise.
有一种误解认为 WebBrowser 控件使用任何当前已安装(当前 IE 版本),但事实并非如此,因为他们这样做是为了减少向后兼容性问题.你可以看到(作为证据)这确实是你的问题www.whatsmyuseragent.com 在您的普通浏览器中,然后转到该网站再次在您的 WebBrowser 控件中,您将看到它说 MSIE 7.0 :).
There is a misconception that WebBrowser control uses whatever is currently installed (current IE version) but this is not true, since they do this to reduce backward compatibility issues. You can see (as proof) that this really is your problem by going to www.whatsmyuseragent.com in your normal browser, and then going to that website again in your WebBrowser control, you will see that it says MSIE 7.0 :).
您可以将其设置为使用当前安装的互联网版本资源管理器,在页面内使用 META 标记,或编辑注册表在将运行 webbrowser 控件的机器上(编辑Current_User 和 Local_Machine 都可以工作).
You can set it to use the current installed version of internet explorer, either using a META tag in-page, or editing the Registry on the machine where the webbrowser control will run (editing for Current_User and Local_Machine will both work).
WebBrowser 控件将(通常)使用您所使用的任何版本的 IE已安装,但出于兼容性原因,它将呈现页面默认在 IE7 标准模式下.
WebBrowser control will (normally) use whatever version of IE you have installed, but for compatibility reasons it will render pages in IE7 Standards mode by default.
如果您想利用新的 IE9 功能,您应该添加元标记 <meta http-equiv="X-UA-Compatible" content="IE=9" >
在 HTML 页面的 <head>
标记内.
If you want to take advantage of new IE9 features, you should add
the meta tag <meta http-equiv="X-UA-Compatible" content="IE=9" >
inside the <head>
tag of your HTML page.
必须在任何指向 CSS、JavaScript 的链接之前添加此元标记<head>
中的文件等也可以正常工作(仅其他 <meta>
标签或 <title>
标签可以在它之前).
This meta tag must be added before any links to CSS, JavaScript
files etc that are also in your <head>
to work properly though (only
other <meta>
tags or the <title>
tag can come before it).
另一种方法是将注册表项添加到:
An alternative is to add a registry entry to:
HKLM > 软件 > 微软 > Internet Explorer > 主要 >FeatureControl > FEATURE_BROWSER_EMULATION
HKLM > SOFTWARE > Microsoft > Internet Explorer > Main > FeatureControl > FEATURE_BROWSER_EMULATION
并在其中添加值为9000"的YourCompiledApplicationName.exe"到强制 WebBrowser 控件以 IE9 模式显示页面.尽管您也可以使用其他值,请注意这些文档不完全准确,因为似乎无法获取页面以 IE 8 模式呈现您使用的任何值.(注意:YourCompiledApplicationName.exe 必须是您编译的包含 WebBrowser 控件的 EXE 文件名,它仅适用于您已包含在注册表中的文件名).此外,添加 vshost.exe 和 YourCompiledApplicationName.exe.svchost 不会有什么坏处,因此它在通过您的 IDE 运行时可以工作,而且,如果您的应用程序在 64 位 Windows 下运行,您可能还应该在以下注册表路径下设置以下 DWORD到相同的值(根据 32 位路径):
And in there add 'YourCompiledApplicationName.exe' with value '9000' to force the WebBrowser control to display pages in IE9 mode. Though there are other values you can use too too, note that these docs aren't entirely accurate as it does not seem possible to get a page to render in IE 8 mode whatever value you use. (Note: YourCompiledApplicationName.exe must be the EXE file name that you compile which contains your WebBrowser Control, it will only work for the file name that you've included in the registry). Also, it wouldnt hurt to add vshost.exe and YourCompiledApplicationName.exe.svchost so it works when run through your IDE, and also, If your app is running under 64bit Windows, you likely should also set the following DWORD under the following registry path to the same value (as per the 32bit path):
HK[LM|CU]SOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControl FEATURE_BROWSER_EMULATION
HK[LM|CU] SOFTWARE Wow6432Node Microsoft Internet Explorer Main FeatureControl FEATURE_BROWSER_EMULATION
将注册表项添加到 HKCU 中的同一路径而不是 HKLM也可以 - 这很有用,因为写信给 HKLM 需要管理员HKCU没有的特权.
Adding the registry key to the same path in HKCU instead of HKLM will also work - this is useful as writing to HKLM requires admin privileges where as HKCU does not.
如果 WebBrowser 控件,不确定 IE 10.0 何时出现默认引擎将转到 10.0(如果 10.0 安装在当然)或者即使在 IE 10.0 之后它仍将保持为 IE 7.0发布,我们将不得不看到它一旦出来.然而,如果我们根据以前的经验猜测,我怀疑 IE 10.0 将是最后一个使用 IE 7.0 渲染引擎的版本,当 IE 11 到来时出,默认渲染引擎将保持为 IE 11 为所有IE 11 和 IE 之间的 IE 版本IE 14. 这只是一个猜测推断他们过去所做的事情.
Not sure if when IE 10.0 comes out if the WebBrowser controls default engine will go to 10.0 (if 10.0 is installed on system of course) or if it will remain as IE 7.0 even after IE 10.0 is released, we will have to see once it comes out. However, if we guess based on previous experience, i suspect IE 10.0 will be the last version that uses IE 7.0 rendering engine, and when IE 11 comes out, the default rendering engine will remain as IE 11 for all versions of IE between IE 11 & IE 14. This is just a guess by extrapolating what they've done in the past.
有关可以将注册表设置为的值的详细信息,看看这个:
For more information on the values you can set the registry to,check this out:
这篇关于脚本在 dotnet WebBrowser 控件中运行速度较慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!