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
随机推荐
- YYYY-mm-dd HH:MM:SS 时间格式
YYYY-mm-dd HH:MM:SS部分解释 d 月中的某一天.一位数的日期没有前导零. dd 月中的某一天.一位数的日期有一个前导零. ...
- To be learned
1.web性能测试工具:LoadRunner:2.web自动化测试工具:selenium QTP:3.安全性测试工具:AppScan4.缺陷管理工具:TestLink+Mantisbt5..抓包工具: ...
- Xshell 命令后台执行
但是这样没有在后台启动:因此sh那一行代码需要修改: 前边加上nohup 后边加上& nohup dotnet helloword.dll & 然后,进程启动之后,按任意键进入输入状态 ...
- 剑指offer二十一之栈的压入、弹出序列
一.题目 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序 ...
- (转)Python科学计算之Pandas详解,pythonpandas
https://www.cnblogs.com/linux-wangkun/p/5903380.html-------pandas 学习(1): pandas 数据结构之Series https:// ...
- Vue的watch监听事件
Vue的watch监听事件 相关Html: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- 【数组】Maximum Subarray
题目: Find the contiguous subarray within an array (containing at least one number) which has the larg ...
- CSS学习笔记(基础篇)
CSS概念 CSS 指层叠样式表 (Cascading Style Sheets)(级联样式表) Css是用来美化html标签的,相当于页面化妆. 样式表书写位置: <head> < ...
- mongodb-mongotemplate进行地理坐标操作
因为项目中使用的springboot + mongotemplate, 所以还是需要mongotemplate的操作方式 首先建立一个bean: package com.iwhere.easy.tra ...
- JDK的spi实现
SPI的全名为Service Provider Interface.大多数开发人员可能不熟悉,因为这个是针对厂商或者插件的.在java.util.ServiceLoader的文档里有比较详细的介绍.简 ...