public ESRI.ArcGIS.Framework.ICommandBar GetToolbarByName(ESRI.ArcGIS.Framework.IApplication application, System.String toolbarName) { ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars; ESRI.ArcGIS.esriSystem.UID barID = new ESRI.ArcGIS.esriSystem.UIDClass(); barID.Value = toolbarName; // Example: "esriArcMapUI.StandardToolBar or TestAddin__Custom_Toolbar" ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(barID, false, false); if (commandItem != null && commandItem.Type == ESRI.ArcGIS.Framework.esriCommandTypes.esriCmdTypeToolbar) { return (ESRI.ArcGIS.Framework.ICommandBar)commandItem; } else return null; }
ESRI.ArcGIS.Framework.ICommandBar myToolbar=GetToolbarByName(m_Application,"TestAddin__Custom_Toolbar"); UID CommandUid = new UIDClass(); //Get Your Button CommandUid.Value ="TestAddin_addin.button"; //Add your command or button myToolbar.Add(CommandUid);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.