AE中IHookHelper的用法 来自http://blog.sina.com.cn/s/blog_6faf711d0100xs1x.html
IHookHelper 主要在用在自定义类型于AE带的的ICommand或ITool等,
1.实例化IHookHelper 对象:
IHookHelper m_hookHelper = new HookHelperClass();
m_hookHelper.Hook = this.axMapControl1.Object ;这样就可以把AxMapControl传递给其它要用到的地方。
2.通过IHookHelper,获取地图控件和主窗体:
IntPtr pHandle = new IntPtr (m_hookHelper.ActiveView.ScreenDisplay.hWnd);
axMapControl1 = System.Windows.Forms.Form.FromHandle(pHandle) as AxMapControl;//对这个地图控件对象操作,会直接反应到主窗体的地图控件上Form. MainForm. = Form.FromHandle(pHandle).FindForm();//这里的主窗体对象之后运行时能起作用,MainForm. 不能直接访问到主窗体里的变量。
3.通过IHookHelper,获取IActiveView和IMap对象
再通过IHookHelper.ActiveView和IHookHelper.FocusMap属性来获取IActiveView和IMap对象,通过这两个接口进行更一步的操作.
4.通过IHookHelper,操作地图
IHookActions hookActions= m_hookHelper as IHookHelper;
获取IHookActions,再通过IHookActions进行Flash,Pan,ZoomTo操作.HOOK实际是一个对象传出的自身的引用或者叫指针或者叫句柄。
例如一个程序,加载一个dll内的对象时通过把Hook传递给要调用的对象,
这样dll内的对象就得到了应用程序传递给他的这个hook,
对象可以通过这个hook查看程序内部的结构。
实际实现时就是对象间传递指向自身的指针传递给另一个对象。IHookHelper m_hookHelper=new HookHelperClass();
m_hookHelper.Hook=axMapControl1.Object;
//这样就获得了axMapControl1控件的一个引用
然后通过m_hookHelper.ActiveView可以获得原axMapControl1的ActiveView项,
用m_hookHelper.FocusMap可以获得IMap对象Provides access to members needed when developing commands to work with the MapControl, PageLayoutControl, ArcMap, and custom controls and applications.
Product Availability
Available with ArcGIS Engine.Description
Use the IHookHelper interface to return the ActiveView, PageLayout or FocusMap of the hook passed to the ICommand::OnCreate event regardless of whether the hook is a MapControl, PageLayoutControl, ToolbarControl or ArcMap.
AE中IHookHelper的用法 来自http://blog.sina.com.cn/s/blog_6faf711d0100xs1x.html的更多相关文章
- 教你如何查看CAD文件是哪个版本的来自http://blog.sina.com.cn/s/blog_4c9fa4dd0101il1v.html
教你如何查看CAD文件是哪个版本的 http://blog.sina.com.cn/s/blog_4c9fa4dd0101il1v.html (2013-03-10 22:24:52) 转载▼ 标签: ...
- quartus ii13.0~16.0 调用uedit (转载http://blog.sina.com.cn/s/blog_6d5560f00102vax6.html)
转自 http://blog.sina.com.cn/s/blog_6d5560f00102vax6.html Quartus II 中的文本编辑软件不好用,比较习惯与UE(Uedit32/ultra ...
- 转自:http://blog.sina.com.cn/s/blog_86e874d30101e3d8.html(谢谢原文作者),Win7下安装CentOS 6.5双系统
经过一下午的折腾,终于在64位的Windows 7上面成功安装了CentOS 6.5(64bit)系统,中途因为硬盘分区的问题失败了一次.下面是安装过程: 在安装过程中借助了这篇文章的内容:http: ...
- http://blog.sina.com.cn/s/blog_4c3b6a070100etad.html
http://blog.sina.com.cn/s/blog_4c3b6a070100etad.html
- http://blog.sina.com.cn/s/blog_5bd6b4510101585x.html
http://blog.sina.com.cn/s/blog_5bd6b4510101585x.html
- http://blog.sina.com.cn/s/blog_5f103c9c0101atny.html
http://blog.sina.com.cn/s/blog_5f103c9c0101atny.html http://www.oschina.net/question/117304_51525
- http://blog.sina.com.cn/s/blog_6940cab30101hn9j.html
http://blog.sina.com.cn/s/blog_6940cab30101hn9j.html
- http://blog.sina.com.cn/s/blog_705cc5dd01012ehb.html
http://blog.sina.com.cn/s/blog_705cc5dd01012ehb.html
- 新浪博客地址 http://blog.sina.com.cn/u/2145079955
原来 新浪博客地址 http://blog.sina.com.cn/u/2145079955
随机推荐
- php判断是否使用手机访问
直接上代码 /** * 检测是否使用手机访问 * @access public * @return bool */ public function isMobile() { if (isset($_S ...
- .Net Core 发布WindowsServices
项目代码文件夹 执行命令 dotnet publish -c Release -r win-x64
- error "Can only specify query options (orderby, where, take, skip) after last navigation" when fetching a List<string>
Question I use OData v3 and WCF in visual studio 2012. I want to return List<string> using the ...
- Java之集合(五)LinkedList
转载请注明源出处:http://www.cnblogs.com/lighten/p/7298017.html 1.前言 Java中另一个常见的list就是本章将要讲的LinkedList.ArrayL ...
- SSH 转发学习【转】
本地端口转发 假定有三台主机A.B.C.由于种种原因(无论是防火墙还是路由原因),AC两台主机之间无法连通.但是B却可以和A.C连通.这时候就可以用本地端口转发来实现A和C通过B来连通. A 192. ...
- 【jQuery源码】jQuery对象初始化
看了一下午还是有很多地方没弄明白,jQuery的一些工具方法的原理也不完全清楚,这篇文章会随着我深入阅读jQuery源码的同时不断更新. // Initialize a jQuery object / ...
- html的css选择器
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 开发工具 -- PyDev 在 Eclipse中的安装
1. 将从sorceforge下载到的PyDev3.4.1解压后放到eclipse的插件目录下F:\APP\IDE\Java\Eclipse\eclipse-java-kepler-SR2-win32 ...
- 编写dimgr脚本学到的知识及技巧
编写dimgr是为了管理手机上的镜像,在此总结下过程中学到的知识及技巧(不讨论具体用法). 参数处理 以往处理脚本参数直接用循环加判断语句,若是脚本只有简单参数,这无疑是简便可行的方法.但当需要处理复 ...
- Maven Debug
1.在pom.xml中新增plugin <plugin> <groupId>org.mortbay.jetty</groupId> <artifact ...