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 ---