• ArcEngine中使用上下左右键移动地图


    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;
            } 


    版权说明

      如果标题未标有<转载、转>等字则属于作者原创,欢迎转载,其版权归作者和博客园共有。
      作      者:温景良
      文章出处:http://wenjl520.cnblogs.com/  或  http://www.cnblogs.com/

  • 相关阅读:
    mysql主从备份案例—读写分离(异步主从)
    MySQL 汉化+完全备份操作实例
    Linux指令和shell脚本
    文件压缩和打包
    文件系统格式化和挂载
    linux常用指令和一些选项的汇总
    linux文件权限和群组
    [windows][技巧]百度网盘提示您的电脑已安装百度网盘,是否覆盖,解决方法
    [html][js]视频倍速播放功能
    [julia][学习笔记]julia的安装
  • 原文地址:https://www.cnblogs.com/wenjl520/p/1387196.html
Copyright © 2020-2023  润新知