GIS二次开发之全图
全图是个不需要和地图进行交互的命令类功能,在实现自定义功能的时候只要重写OnClick事件即可,在自带的类中,也只有ControlsMapFullExtentCommand这个Command类。哈哈,这个功能几句话就解决了,看看代码吧。
代码
public MapFullExtent()
{
string[] res = GetType().Assembly.GetManifestResourceNames();
base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("Commands.fullExtent.bmp"));
base.m_caption = "全图";
base.m_category = "ToolBar";
base.m_message = "全图";
base.m_name = "ToolBar_MapPan";
base.m_toolTip = "全图";
}
public override void OnCreate(object hook)
{
try
{
m_HookHelper.Hook = hook;
m_pActiveView = m_HookHelper.ActiveView as IActiveView;
}
catch { m_pActiveView = null; }
}
public override void OnClick()
{
if (null == m_pActiveView) return;
m_pActiveView.Extent = m_pActiveView.FullExtent;
m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
{
string[] res = GetType().Assembly.GetManifestResourceNames();
base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("Commands.fullExtent.bmp"));
base.m_caption = "全图";
base.m_category = "ToolBar";
base.m_message = "全图";
base.m_name = "ToolBar_MapPan";
base.m_toolTip = "全图";
}
public override void OnCreate(object hook)
{
try
{
m_HookHelper.Hook = hook;
m_pActiveView = m_HookHelper.ActiveView as IActiveView;
}
catch { m_pActiveView = null; }
}
public override void OnClick()
{
if (null == m_pActiveView) return;
m_pActiveView.Extent = m_pActiveView.FullExtent;
m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
相当的简单啊,哈哈。