MapControl控件(转)

MapControl对应ArcMap中的数据视图,它封装了Map对象,并提供了额外的属性、方法、事件用于:管理控件的外观、显示属性和地图属性;添加并管理控件中的数据层(data layers);装载Map文档(mxd)控件中;从其他应用程序拖放数据到空间中;tracking shapes and drawing to the display。

ArcGIS的每种控件都有属性可以设置,它们可以在可视化环总重进行编译。将控件拖放到窗体上后,用户可以右键点击,选中“属性”菜单来编辑这些属性,它们可以让用户在不编写移行代码的情况下快速构建一个GIS应用程序。

MapControl 实现的主要接口有:IMapControlDefault、IMapControl2、IMapControl3 和事件接口IMapControlEvents2。

IMapControlDefault接口是地图控件缺省接口,多数开发环境自动使用这个接口定义属性、方法。这个接口也代表了控件最新版本的接口,MapControl 当前最新版本接口为 IMapControl3。

当需要使用这个接口的时候,可以使用下面的代码:IMapControlDefault pMapControl;
pMapControl = axMapControl1.Object as IMapControlDefault;

IMapControl2是任何一个与MapControl相关的任务的出发点,如设置控件外观,设置Map对象或控件的显示属性,添加或者管理数据图层、地图文档,在控件上绘制图形和返回Geometry等。IMapControl2定义了控制控件外观界面的种属性和方法,如Appearance、BorderStyle和BackColor。它定义的主要方法有TrackLine、TrackPolygon、TrackRectangle和Track Circle方法让程序员可以直接在控件上获得Geoemtry对象,它还提供了Drawshape和DrawText方法让用户直接在控件上绘制图形。

IMapContronl3接口继承IMapContronl2,并增加了以下8个属性和一个方法:CustomProperty设置自定义控件属性;DocumentFilename返回MapControl装入的地图文档的文件名;DocumentMap返回MapControluihou装入地图名称;KeyIntercept返回或设置MapControl截取键盘按键信息;Object返回潜在的MapControl控件,When querying interface to IMapControl2 in Visual Basic .NET or Visual C# .NET the Object property or container specific code must be used. This is because .NET contains the real control inside a wrapper object known as an host。{当使用IMapControl2接口时: ????
IMapControl2 pMapControl;
pMapControl = axMapControl1.Object as IMapControl2;

pMapControl = axMapControl1.GetOcx() as IMapControl2;
当使用IMapControl3 接口时:????
IMapControl3 pMapControl;
pMapControl = axMapControl1.Object as IMapControl3;

pMapControl = axMapControl1.GetOcx() as IMapControl3;};

ShowMapTips确定是否显示地图的Map Tips;TipDelay设置Map Tips的延迟时间;TipStyle设置Map Tips的显示样式;SuppressResizeDrawing ()当控制尺寸发生变化时阻止数据实时重绘。

esriKeyIntercept Constants?
Options for intercepting key presses handled by a controls container, these
values can be combined into a bit mask.
esriKeyIntercept 可能取值???
Constant                      Value              Description
esriKeyInterceptNone      0                  No keys are intercepted.
esriKeyInterceptArrowKeys 1               Intercepts the arrow keys, normally handled by the container to change control focus.
esriKeyInterceptAlt             2                Intercepts the Alt key, normally handled by a container to change focus.
esriKeyInterceptTab          4                Intercepts the Tab key, normally handled by the container to change control focus.
esriKeyInterceptEnter        8               Intercepts the Enter key, normally handled by the container to click the default button.
IMapControlEvents2是个事件接口,它定义了MapControl能够处理的全部事件,如OnMouseDown、OnAfterDraw、 OnMouseMove等,这些事件用户在建构独立程序过程中经常用到。如OnAfterscreenDraw是绘屏结束后触发的事件,OnExtentUpdated是地图的Extent属性发生变化时触发的事件等。

转载于:https://www.cnblogs.com/yaojian/archive/2011/03/10/1979614.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值