WPF 添加ACTIVEX 控制項 ——System.Windows.Forms.AxHost+InvalidActiveXStateException異常

來源:互聯網
上載者:User

標籤:

---恢複內容開始---

一、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則以提供進一步的網路應用與使用者互動為主。 二、WPF 加入ACtiveX 控制項

  使用 WindowsFormsHost 元素可將 Windows Forms控制項放置到 WPF 元素或頁面中。

  若要在 Windows Forms控制項或表單中承載 WPF 元素,使用 ElementHost控制項

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

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

3.執行個體化Activex控制項 、初始化控制項、控制項複值到host 

  txsl1 = new activex();

  host.Child = txsl1;

4.添加Host對象到WPF 表單

      this.mainGrid.Children.Add(host);

---恢複內容結束---

WPF 添加ACTIVEX 控制項 ——System.Windows.Forms.AxHost+InvalidActiveXStateException異常

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.