ArcEngine中使用上下左右键移动地图
2007-05-24 13:25
337 查看
//Allow the MapControl to intercept arrowkeys when it has focus
axMapControl1.KeyIntercept = 1;
private void axMapControl1_OnKeyDown(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnKeyDownEvent e)
{
switch (e.keyCode)
{
case (int)System.Windows.Forms.Keys.Up:
PanMap(0d, 0.5d);
break;
case (int)System.Windows.Forms.Keys.Down:
PanMap(0d, -0.5d);
break;
case (int)System.Windows.Forms.Keys.Left:
PanMap(-0.5d, 0d);
break;
case (int)System.Windows.Forms.Keys.Right:
PanMap(0.5d, 0d);
break;
}
}
private void PanMap(double ratioX, double ratioY)
{
//Pans map by amount specified given in a fraction of the extent e.g. rationX=0.5, pan right by half a screen
IEnvelope envelope = axMapControl1.Extent;
double h = envelope.Width;
double w = envelope.Height;
envelope.Offset(h * ratioX, w * ratioY);
axMapControl1.Extent = envelope;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1217767
axMapControl1.KeyIntercept = 1;
private void axMapControl1_OnKeyDown(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnKeyDownEvent e)
{
switch (e.keyCode)
{
case (int)System.Windows.Forms.Keys.Up:
PanMap(0d, 0.5d);
break;
case (int)System.Windows.Forms.Keys.Down:
PanMap(0d, -0.5d);
break;
case (int)System.Windows.Forms.Keys.Left:
PanMap(-0.5d, 0d);
break;
case (int)System.Windows.Forms.Keys.Right:
PanMap(0.5d, 0d);
break;
}
}
private void PanMap(double ratioX, double ratioY)
{
//Pans map by amount specified given in a fraction of the extent e.g. rationX=0.5, pan right by half a screen
IEnvelope envelope = axMapControl1.Extent;
double h = envelope.Width;
double w = envelope.Height;
envelope.Offset(h * ratioX, w * ratioY);
axMapControl1.Extent = envelope;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1217767
相关文章推荐
- ArcEngine中使用上下左右键移动地图
- ArcEngine中使用上下左右键移动地图功能的实现
- ArcEngine中使用上下左右键移动地图
- ArcEngine中使用上下左右键移动地图
- 使用javascript操作多选列表框,实现动态增加删除,左右移动,上下排序移动等功能。
- Isometric Game Programming 笔记(二)按键控制地图上下左右方向移动
- silverlight中 Storyboard(动画)的使用,实现球的上下循环移动,左右移动,及旋转功能
- 使用jquery实现上下左右移动效果
- TiledMapEditor创建地图,精灵在地图上下左右移动,尚未实现碰撞检测功能
- jquery 实现上下左右回车键按下 移动文本框焦点
- Android 仿QQ菜单背景图片的左右上下移动属性动画实现
- 使用RecyclerView实现ListView,GridView的效果(上下,左右滑动),拖拽与滑动删除
- 利用键盘上的上下左右(回车)键模拟出tab 键的功能上下左右移动焦点
- oracle sql命令行中上下左右使用
- 利用键盘上的上下左右(回车)键模拟出tab 键的功能上下左右移动焦点
- jquery鼠标移动div内容上下左右滚动
- Drag and Drop from Grid to Grid Example,增加上下、左右移动的功能。
- html中上下左右控制对象移动Demo
- Vi乱码/上下左右 backspace不能使用的问题
- javascript select控件的使用及左右移动item的逻辑处理