Unable to add toolbars using ArcObjects

المشرف العام

Administrator
طاقم الإدارة
I am creating a ArcMap Addin, where all the toolbars will be removed from the document and then the 3 toolbars that I need will be added.

Currently I have the following code

public void getCommandBar(string val){ try { IDocument document = ArcMap.Application.Document; ICommandBars commandBars = document.CommandBars; UID toolbarUID = new UID(); toolbarUID.Value = val; ICommandBar CommandBar; CommandBar = commandBars.Find(toolbarUID, false, false) as ICommandBar; CommandBar.Dock(esriDockFlags.esriDockFloat, null); } catch (Exception ex) { MessageBox.Show(ex.Message); }}The 3 toolbars that I need added are

  1. Tools Toolbar - {E1F29C75-4E6B-11D2-AE2C-080009EC732A}
  2. Editor Toolbar - {C671B640-83B9-11D2-850C-0000F875B9C6}
  3. Custom toolbar (created from the addin) - {92B5228F-D2B4-9280-F6B8-E17CB587260C}
The tools toolbar get added with no problem, but for some reason it fails on the Editor tool bar with the following message

object not set to an instance of an object

even though i have got the GUID from here, my custom toolbar does not get added either (I found the GUID from the ArcID module).

I have tried other random toolbars from the ArcMap ID's links and they work fine (apart from the ones I need).

Has anyone have any ideas on why the Editor and Custom toolbar are not getting added.



أكثر...
 
أعلى