鼠标拖动添加指北针,鼠标拖动的范围为指北针的范围


            }

            //如果捕捉的区域对象为空 或是区域高或宽为0 就退出函数
            if (m_Feedback == null)
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }
            IEnvelope envelope = m_Feedback.Stop();
            if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0))
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }
            //建立并弹出指北针样式选择框
            SelectSymbolDialog symbolForm = new SelectSymbolDialog("请选择指北针的显示样式:");
            //得到选中的指北针样式
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows);
            // 释放选择窗体
            symbolForm.Dispose();
            //如果没有选择就退出函数
            if (styleGalleryItem == null)
            {
                return;
            }
            //得到焦点地图的框架结构
            IMapFrame mapFrame = (IMapFrame)m_HookHelper.ActiveView.GraphicsContainer.FindFrame(m_HookHelper.ActiveView.FocusMap);
            //创建一个环境框架
            IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
            //把声明的环境框架和地图框架联系起来
            mapSurroundFrame.MapFrame = mapFrame;
            mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item;
            //把环境框架转换成一个元素
            IElement element = (IElement)mapSurroundFrame;
            element.Geometry = envelope;
            //把元素添加到容器中,并绘制
            m_HookHelper.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0);
            //刷新
            m_HookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null);
            m_Feedback = null;
            m_InUse = false;
        }

    }
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值