see
Host Secure, Lightweight Client-Side Controls in Microsoft Internet Explorer
http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx

解决方案 »

  1.   

    sing Windows Forms Controls in Internet Explorer
    在IE浏览器里使用Windows Forms控件http://www.gotdotnet.com/team/windowsforms/iesourcingBeta1.aspx本文描述了如何在IE浏览器中执行Windows Forms控件。使用者不用做任何提示,也无需注册,这些Windows Forms控件就能在IE里自动激活,并实现Common Language Runtime(CLR)的代码安全机制.在IE中激活Windows Forms控件可以分四步来完成,下面所列的是详细的步骤:
    * 创建Windows Forms控件;
    * 创建一个包含对象标签的HTML文档;
    * 创建虚拟目录,复制并设置权限;
    * 运行该控件。
    1. Windows Forms控件:SimpleControl.dll
    几乎所有的Windows Forms控件都可以用,但在这个例子里,我们使用的是包含在.NET Framework SDK QuickStart Tutorial Creating Controls中的SimpleControl控件。
    2. HTML文档: SimpleControl.html
    接下来一步是生成内有一个对象tag的HTML文档,以激活Windows Forms控件。此外,还要加入一些脚本和输入tag(input tags)到该控件的示范程序入口。
    <object id="simpleControl1"classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"height="300"width="300"><param name="Text" value="Simple Control"></object>
      

  2.   

    创建带有 object 标记的 HTML 文档
    下一步是创建带有 object 标记的 HTML 文档,该标记引用 Windows 窗体控件。对于此示例,还将添加一些简单的脚本和输入标记,以演示对该控件进行编程访问。<object id="simpleControl1"classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
    height="300" width="300" VIEWASTEXT>
    <param name="Text" value="Simple Control">
    </object>
    classid 有两个令人感兴趣的部分:指向控件库的路径和控件的完全限定名,这两者由 # 号分隔开。如果您熟悉 ActiveX object 标记,将注意到缺少一个 guid。在 Windows 窗体中,路径和完全限定类名的组合作为唯一标识符。Param 标记可用于设置控件上的属性。在这种情况下,name 特性是属性的名称,value 特性是属性的值。<script>function ChangeText() {
    simpleControl1.Text = text1.value;
    }</script>
    ?-<input type="text" id="text1">
    <input type="button" value="Change Text" onclick="ChangeText()">
    若要获取对控件的编程访问,可以针对该控件编写脚本。将该页上的按钮和文本框与简单 JScript 函数 ChangeText 一起使用来设置控件的 text 属性。下面是此示例的完整 HTML 和脚本代码。<html><script language="JScript">function ChangeText() {
    simpleControl1.Text = text1.value;
    }</script><body><p>Simple Control
    <br>
    <br>
    </body><object id="simpleControl1"classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
    height="300" width="300" VIEWASTEXT>
    <param name="Text" value="Simple Control">
    </object><br>
    <br><input type="text" id="text1">
    <input type="button" value="Change Text" onclick="ChangeText()"></html>创建虚拟目录并设置权限
    该 HTML 页必须驻留在 Web 服务器上的 IIS 虚拟目录中,而且必须具有相应的权限。在此示例中,Windows 窗体控件驻留在同一目录中,但它也可以安装到全局程序集缓存中。虚拟目录上的执行权限必须设置为 scripts,如果执行权限设置为 scripts & executables,则将无法正确激活该控件。对于此示例,已经为您执行了这些步骤。运行该控件
    若要运行该控件,只需将 Internet Explorer 指向虚拟目录中的该 HTML 页。如果该控件没有正确激活,可能需要重新启动 Internet Explorer。
      

  3.   

    http://expert.csdn.net/Expert/topic/954/954834.xml
      

  4.   

    http://expert.csdn.net/Expert/topic/954/954834.xml
    :)