The following uses the vs2008 development environment as an example:
----------------------------------------------------------------------
Step 1: Convert the COM interface to a. net interface
Before using mapwingis. ocx in the. NET language, you must convert the COM interface to the. NET interface,ProgramAccess the specific implementation functions in COM through the. NET interface.
Method (1) When mapwingis. ocx is added to the. NET project, a file named InterOP. mapwingis. dll (or InterOP. mapwingis.4.7.dll) is automatically generated. This dll is the. net interface component generated by vs2008 for the added OCX. The program uses this DLL to deal with OCX.
You can also use the tlbimp.exe tool of vs2008to manually obtain this file.
A. Open the vs2008 command line (Start Menu -- Microsoft Visual Studio 2008 -- Visual Studio Tools -- Visual Studio 2008 command prompt)
B.
Cd c: \ Dev \ mapwindow4dev \ bin
Tlbimp mapwingis. ocx/out: InterOP. mapwingis. dll/asmversion: 4.7.4.0
Step 2: Wrap the OCX control into a Windows Forms Control
For the OCX control, it is not enough to convert the COM interface to the. NET interface. You also need to use aximp to wrap the OCX control into Windows Forms control.
Aximp "mapwingis. ocx"/out: axinterop. mapwingis. dll/RCW: InterOP. mapwingis. dll
Before using this command, you must register OCX and generate InterOP. mapwingis. dll.
Step 3: reference in the projectINterop. mapwingis. dllAndAxinterop. mapwingis. dll
In this way, you can use mapwingis. ocx to develop applications. Of course, after the mapwindow GIS desktop version is installed, you can get it directly from the installation directory (mapwingis. ocx, InterOP. mapwingis. dll and axinterop. mapwingis. dll)
For more com and. Net interoperability tools, refer:Http://msdn.microsoft.com/zh-cn/library/dd233112.aspx