剛:
首先全部: 感謝Boo & Lex Li 爲了幫助我找到答案對我的問題。
你有一定的註冊表設置爲正確的值:
有32位和64個應用程序的兩個不同的密鑰組。
32位:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
Value Key: yourapplication.exe
64位:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
Value Key: yourapplication.exe
的值來設置該鍵被(從MSDN採取這裏)爲十進制值:
9999 (0x270F)
Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.
9000 (0x2328)
Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.
8888 (0x22B8)
Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.
8000 (0x1F40)
Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.
7000 (0x1B58)
Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.
即使艱難的MSDn聲稱9000是自動分配的值。這顯然不是真的。
下面您可以找到代碼如何將這些鍵添加到您的註冊表。請注意,在調試時,您的應用程序具有不同的進程名稱。
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (key != null)
{
key.SetValue("YourApplicationName.exe", 9000, RegistryValueKind.DWord);
}
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (key != null)
{
key.SetValue("YourApplicationName.exe", 9000, RegistryValueKind.DWord);
}
所以感謝所有的好運
編輯:用戶帳戶控制應該關閉,以使此代碼工作。
請不要用 「C#」 和這樣的前綴您的圖書。這就是標籤的用途。 – 2012-04-21 01:14:45
好吧,對不起,第一個問題 – RoXaS 2012-04-21 10:22:30