AO 获取系统自带的工具条

备忘给自己看.

如何调用系统自带的Editor编辑工具条,并打开Editor工具条。

代码如下:ICommandBars commandBars = m_application.Document.CommandBars;

AO 获取系统自带的工具条
UID barID = new ESRI.ArcGIS.esriSystem.UIDClass();
barID.Value = "esriEditor.EditorToolBar";// Example: "esriArcMapUI.StandardToolBar"
//得到Editor工具条
ICommandItem barItem = commandBars.Find(barID, false, false);
if (barItem != null && barItem.Type == esriCommandTypes.esriCmdTypeToolbar)
{
  ESRI.ArcGIS.Framework.ICommandBar commandBar = (ESRI.ArcGIS.Framework.ICommandBar)barItem;
   //打开Editor工具条
   commandBar.Dock(esriDockFlags.esriDockShow, null);
IEngineEditLayers editLayers = editor as IEngineEditLayers;
  IFeatureLayer featureLayer = waterLayer as IFeatureLayer;
  IDataset dataset = featureLayer.FeatureClass as IDataset;
  IWorkspace workspace = dataset.Workspace;

  UID editorID = new UIDClass();
  editorID.Value = "esriEditor.Editor";
  IEditor editor = m_application.FindExtensionByCLSID(editorID) as IEditor;
    if (editor != null)
  {
    editor.StartEditing(workspace);
  }
  else
  {
    MessageBox.Show("不可编辑,请确认图层没有被其它程序打开。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  }
}
AO 获取系统自带的工具条

AO 获取系统自带的工具条

上一篇:误区30日谈16-20


下一篇:解析nginx负载均衡