Add a standard .NET toolbar to your form and create buttons for the tools you want. Inside the button click events, get references to the tools you want (via IDocument.CommandBars.Find) and set them to be the current tool (via IApplication.CurrentTool).
private void toolStripButton1_Click(object sender, EventArgs e) { UID pUID = new UIDClass(); pUID.Value = "esriArcMapUI.ZoomInTool"; // Error: Value does not fall within the expected range ESRI.ArcGIS.Framework.ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(pUID, false, false); if (commandItem != null) { ArcMap.Application.CurrentTool = commandItem; } }
Try using the actual GUID for the tool instead of the ProgId. {AD1891E4-7C79-11D0-8D7C-0080C7A4557D}I've run into problems using the ProgId.
Les membres connectés peuvent publier, suivre les mises à jour et bien plus encore. Nouveau ici ? Créez un compte gratuit.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.