}
//如果捕捉的区域对象为空 或是区域高或宽为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;
}
}