WPF 添加ACTIVEX 控件 ——System.Windows.Forms.AxHost+InvalidActiveXStateException异常

---恢复内容开始---网络

1、ACTIVEX及其相关概念分布式

COM(Component Object Model,对象组件模型);
DCOM(Distributed COM, 分布式对象组件模型);
CORBA(Common Object Request Broker Architecture, 公共对象请求代理体系结构);
 
动态数据交换(Dynamic Data Exchange,DDE),解决了数据的更新,但数据格式还是问题;
对象的连接与嵌入(Object Linking and Embedded,OLE),数据交换提升到“ 对象交换”;
ActiveX是指宽松定义的、基于COM的技术集合,而OLE仍然仅指复合文档;ActiveX和OLE的最大不一样在于,OLE针对的是桌面上应用软件和文件之间的集成,而 ActiveX则以提供进一步的网络应用与用户交互为主。
 
2、WPF 加入ACtiveX 控件

  使用 WindowsFormsHost 元素可将 Windows Forms控件放置到 WPF 元素或页面中。ui

  若要在 Windows Forms控件或窗体中承载 WPF 元素,使用 ElementHost控件this

1.添加引用 WindowsFormsIntegration ;
 
2.建立 WindowsFormsHost 对象

        System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();spa

3.实例化Activex控件 、初始化控件、控件复值到host 代理

  txsl1 = new activex();orm

  host.Child = txsl1;htm

4.添加Host对象到WPF 窗体对象

      this.mainGrid.Children.Add(host);element

---恢复内容结束---

相关文章
相关标签/搜索