Solution when ArcEngine reports that an event exists in both AxMapControl and MapControl

Source: Internet
Author: User
Tags dotnet
Development Environment: vs. NET 2005 (C #)
AE version: 9.2 SP4

Error message:
The Type 'esri. arcGIS. mapcontrol. imapcontrolevents2_onoledropeventhandler 'exists in both 'e: \ Program Files \ ArcGIS \ DOTNET \ ESRI. arcGIS. mapcontrol. dll 'and 'e: \ ProgramFiles \ ArcGIS \ DOTNET \ ESRI. arcGIS. axmapcontrol. dll'

1. in. NET 2005, go to your project's references folder in Solution Explorer. select ESRI. arcGIS. axmapcontrol or ESRI. arcGIS. mapcontrol. in the properties pane, change aliases from global to global, mapcontrolalias.

Add both axmapcontrol and mapcontrol to the reference, modify the attributes referenced by ESRI. ArcGIS. axmapcontrol, and modify its aliases (alias) by "Global" to "Global, mapcontrolalias ";
2. In your code at the first line in the file Add: extern alias mapcontrolalias;
Add extern alias mapcontrolalias before other namespaces;
3. Add alias to your ambiguous call. Ex. this. axMapControl1.OnMouseMove + = new MapControlAlias: ESRI. ArcGIS. MapControl. IMapControlEvents2_OnMouseMoveEventHandler (this. axmapcontrolpoliconmousemove );
Add the alias: object to be called
This shoshould work, don't worry about trying to do commandline/references as I couldn't figure it out, but the Properties Alias worked.

After modification, it is as follows:
Reference code:
Extern alias MapControlAlias;

Using DevExpress. XtraEditors;
Using DevExpress. XtraEditors. Controls;
Using ESRI. ArcGIS. Carto;
Using ESRI. ArcGIS. DataSourcesFile;
Using ESRI. ArcGIS. DataSourcesRaster;
Using ESRI. ArcGIS. esriSystem;
Using ESRI. ArcGIS. Geodatabase;

Class Code:
This. axmapcontrol1.onmousemove + = new mapcontrolalias: ESRI. ArcGIS. mapcontrol. imapcontrolevents2_onmousemoveeventhandler (this. axmapcontrolpoliconmousemove );
This. axmapcontrol1.onafterdraw + = new mapcontrolalias: ESRI. ArcGIS. mapcontrol. imapcontrolevents2_onafterdraweventhandler (this. axmapcontrolpoliconafterdraw );

From: C = 159 & F = 1707 & t = 171978 & Mc = 6

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