ACTIVEX Control added in WPF -- System. Windows. Forms. AxHost + InvalidActiveXStateException exception, invaliddevicestate

Source: Internet
Author: User

ACTIVEX Control added in WPF -- System. Windows. Forms. AxHost + InvalidActiveXStateException exception, invaliddevicestate

--- Restore content start ---

1. ACTIVEX and related concepts

COM (Component Object Model, Object Component Model); DCOM (Distributed COM, Distributed Object Component Model); CORBA (Common Object Request Broker Architecture, public Object Request proxy Architecture ); dynamic Data Exchange (DDE) solves Data updates, but the Data format is still a problem. Object link and embedding (Object Linking and Embedded, OLE ), data exchange is upgraded to "Object Exchange". ActiveX refers to a loosely defined and COM-based technology set, while OLE still only refers to composite documents. The biggest difference between ActiveX and OLE is that, OLE is designed for the integration of application software and files on the desktop, while ActiveX focuses on providing further interaction between network applications and users. Ii. Add ACtiveX controls to WPF

You can use the WindowsFormsHost element to place the Windows Forms control in the WPF element or page.

To host the WPF element in a Windows Forms control or form, use the ElementHost Control

1. Add reference WindowsFormsIntegration; 2. Create a WindowsFormsHost object

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

3. instantiate Activex controls, initialize controls, and reset controls to host

Txsl1 = new activex ();

Host. Child = txsl1;

4. Add the Host object to the WPF form

This. mainGrid. Children. Add (host );

--- Restore content end ---

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.