需要在客户端进行一些打印等需要操作客户端机器的功能,一种可以带带ActiveX的方法是直接嵌入Winform,很简洁,很方便,如下
https://social.msdn.microsoft.com/Forums/en-US/2c3bfca4-b616-48e5-9280-25db87981cbf/hosting-windows-forms-control-in-ie?forum=winforms
但是有时候不同的机器有的不能加载控件,很多原因,
http://blog.jonschneider.com/2007/04/windows-forms-controls-in-ie.html
仔细分析下,试试,发现.net 版本号可能是个大问题,把.net 4.0以上的卸载竟然可以了,具体是因为控件版本不一致呢,还是如下所述微软在4.0以后就不支持这个功能了需要进一步测试看看。
https://social.msdn.microsoft.com/Forums/en-US/6fcbae32-d3a9-4109-a804-96628fd26fa6/internet-explorer-will-not-display-a-hosted-forms-control?forum=iewebdevelopment
偶尔又查了一下,注册表里修改一下可能就可以了
http://stackoverflow.com/questions/12109642/loading-net-usercontrols-in-ie-with-net-4-5
This is documented in the .NET 4.5 Application Compatibility Page on MSDN:http://msdn.microsoft.com/en-us/library/hh367887.aspx . Hosting managed controls inside IE is no longer supported out of the box (see half-way down under "Web Applications"):
Feature: Managed browser hosting controls from the .NET Framework 1.1 and 2.0
Change: Hosting these controls is blocked in Internet Explorer.
Impact: Internet Explorer will fail to launch an application that uses managed browser hosting controls. The previous behavior can be restored by setting the EnableLegacyIEHosting value of the registry subkey HKLM/SOFTWARE/MICROSOFT/.NETFramework to 1.
Unfortunately, the information on the registry key appears to be incomplete and wrong:
-
The setting is actually called "EnableIEHosting".
-
It must be located either in the HKCU Hive: HKCU\SOFTWARE\Microsoft\.NETFramework
- or the HKLM hive, but under different paths, depending on the 32/64bit type of Windows:
- 32-bit System: HKLM\SOFTWARE\MICROSOFT\.NETFramework
- 64-bit System: HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework
This was tested on both Windows Server 2008R2 and Windows 8.
微软的官方解决方案链接:
https://support.microsoft.com/en-us/kb/2996039