设置当前工具或者命令
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using ESRI.ArcGIS.SystemUI;
//using System.Windows.Forms;
//namespace ArcGisPublic
//{
// public class CommandAndDo
// {
// public void SetCurrentDo(object mapControl, ICommand pCommand, bool ishint = true) //设置当前动作
// {
// try
// {
// if (mapControl is ESRI.ArcGIS.Controls.AxMapControl)
// {
// pCommand.OnCreate((mapControl as ESRI.ArcGIS.Controls.AxMapControl).Object);
// pCommand.OnClick();
// }
// else if (mapControl is ESRI.ArcGIS.Controls.AxPageLayoutControl)
// {
// pCommand.OnCreate((mapControl as ESRI.ArcGIS.Controls.AxPageLayoutControl).Object);
// pCommand.OnClick();
// }
// }
// catch (Exception ex)
// {
// if (ishint)
// {
// MessageBox.Show("异常:" + ex.Message.ToString());
// }
// }
// }
// public void SetCurrentTool(object mapControl, ICommand pCommand) //设置当前工具
// {
// if (mapControl is ESRI.ArcGIS.Controls.AxMapControl)
// {
// pCommand.OnCreate((mapControl as ESRI.ArcGIS.Controls.AxMapControl).Object);
// (mapControl as ESRI.ArcGIS.Controls.AxMapControl).CurrentTool = pCommand as ITool;
// }
// else if (mapControl is ESRI.ArcGIS.Controls.AxPageLayoutControl)
// {
// pCommand.OnCreate((mapControl as ESRI.ArcGIS.Controls.AxPageLayoutControl).Object);
// (mapControl as ESRI.ArcGIS.Controls.AxPageLayoutControl).CurrentTool = pCommand as ITool;
// }
// }
// }
//}