欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap 谈天说地
   您现在位于: 首页技术专栏ArcGIS应用与开发AO开发 → 正文
VS2005不支持TOCControl控件的问题解决
08-03-06 12:04:56 作者: 出处:浩淼的天空

如果你用VS2005写AE程序,使用了TOCControl控件(其它可视化控件也一样),双击这个控件产生OnClick事件,然后直接编译,肯定会出现一个错误,说事件处理器同时存在两个DLL中冲突云云。解决方法在ESRI的论坛上看到,在GIS Empire上也看到了解决方法,特转载:

Developer Scenario Building Application with windows controls using VS 2005 C# 
Author Peter v 
Date Jul 12, 2007 
Message I ran into a problem in using .net 2.0 / VS2005 for a provided solution with a tutorial, a so called developer scenario, found in \ArcGIS\DeveloperKit\Help\Java\ArcGISEngine\EngineDevGd_Ch6.pdf) part of the helpfiles of ArcGIS 9.1.

The project won't compile because a bunch of references seem to have conflicting names. Removing them works up to ESRI.ArcGIS.TOCControl and ESRI.ArcGIS.PageLayoutControl. Which use elements which is provided by them as well as their ActiveX equivalents, ESRI.ArcGIS.AxTOCControl and ESRI.ArcGIS.AxPageLayoutControl.

A solution we found after some searching was to use reference extern aliases. Provide an alias for the aliases property of ESRI.ArcGIS.TOCControl and ESRI.ArcGIS.PageLayoutControl, eg. Com. 【给有冲突的两个Assembly中的一个取个别名,如AxMapControl和MapControl就冲突,可以将MapControl的alias属性由global设置为COM等等,随便你取什么】

Add on top of the using directives "extern alias Com;" 【在使用该Assembly的类前标明如下语句extern alias COM】
Now you can fully qualify members of the reference by "Com::ESRI.ArcGIS.TOCControl." 【现在使用MapControl就是COM.ESRI.ARCGIS.TOCControl】

In addition you can also add the using directives
using Com.ESRI.ArcGIS.TOCControl;
using Com.ESRI.ArcGIS.PageLayoutControl;

Then you do not need to change the code at all, and the solution compiles magically. I only wonder how the compiler solves the naming conflict... Hope the solution can be of help.

9 7 3 1 2 4 8 :

(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  
    无相关新闻

    关于我们 友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.

                   滇ICP备05006901号