Web Browser Control Emulation Issues with FEATURE_BROWSER_EMULATION
Problem Description:
When using the Web Browser control in Visual Studio 2013, setting the FEATURE_BROWSER_EMULATION registry key for the application to IE10 or IE11 emulation values results in the control malfunctioning. Specifically, the month date picker on a Dojo Toolkit demo page (http://demos.dojotoolkit.org/demos/calendar/demo.html) fails to work correctly.
Solution:
The issue resides in the FEATURE_NINPUT_LEGACY_MODE registry setting. Disabling this setting, along with enabling other features via registry configuration, resolves the problem. Here's a revised solution:
const int POLL_DELAY = 250; WebBrowser _webBrowser; // set WebBrowser features, more info: http://stackoverflow.com/a/18333982/1768303 static void SetWebBrowserFeatures() { // don't change the registry if running in-proc inside Visual Studio if (LicenseManager.UsageMode != LicenseUsageMode.Runtime) return; var appName = System.IO.Path.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); var featureControlRegKey = @"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\"; Registry.SetValue(featureControlRegKey + "FEATURE_BROWSER_EMULATION", appName, GetBrowserEmulationMode(), RegistryValueKind.DWord); // enable the features which are "On" for the full Internet Explorer browser Registry.SetValue(featureControlRegKey + "FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION", appName, 1, RegistryValueKind.DWord); Registry.SetValue(featureControlRegKey + "FEATURE_AJAX_CONNECTIONEVENTS", appName, 1, RegistryValueKind.DWord); Registry.SetValue(featureControlRegKey + "FEATURE_GPU_RENDERING", appName, 1, RegistryValueKind.DWord); Registry.SetValue(featureControlRegKey + "FEATURE_WEBOC_DOCUMENT_ZOOM", appName, 1, RegistryValueKind.DWord); // Disable FEATURE_NINPUT_LEGACY_MODE Registry.SetValue(featureControlRegKey + "FEATURE_NINPUT_LEGACYMODE", appName, 0, RegistryValueKind.DWord); }
With this updated configuration, the Web Browser control should now function properly with both IE10 and IE11 emulation settings for the application.
The above is the detailed content of Why does my Web Browser control in Visual Studio malfunction when setting FEATURE_BROWSER_EMULATION to IE10 or IE11?. For more information, please follow other related articles on the PHP Chinese website!