Beispiel #1
0
        //Pan모드 선택처리
        public void FindCommandAndExecute(IApplication application)
        {
            ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars;
            ESRI.ArcGIS.esriSystem.UID         uid         = new ESRI.ArcGIS.esriSystem.UID();
            uid.Value = "esriControls.ControlsMapPanTool";
            ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(uid, false, false);

            if (commandItem != null)
            {
                commandItem.Execute();
            }
        }
Beispiel #2
0
        public void SetToolActiveInToolBar(ESRI.ArcGIS.Framework.IApplication application, System.String toolName)
        {
            ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars;
            ESRI.ArcGIS.esriSystem.UID         commandID   = new ESRI.ArcGIS.esriSystem.UIDClass();
            commandID.Value = toolName; // example: "esriArcMapUI.ZoomInTool";
            ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(commandID, false, false);

            if (commandItem != null)
            {
                application.CurrentTool = commandItem;
            }
        }
        ///<summary>Find a command and click it programmatically.</summary>
        ///
        ///<param name="application">An IApplication interface.</param>
        ///<param name="commandName">A System.String that is the name of the command to return. Example: "esriFramework.HelpContentsCommand" or "{D74B2F25-AC90-11D2-87F8-0000F8751720}"</param>
        ///
        ///<remarks>Refer to the EDN document http://edndoc.esri.com/arcobjects/9.1/default.asp?URL=/arcobjects/9.1/ArcGISDevHelp/TechnicalDocuments/Guids/ArcMapIds.htm for a listing of available CLSID's and ProgID's that can be used as the commandName parameter.</remarks>
        public void FindCommandAndExecute(ESRI.ArcGIS.Framework.IApplication application, System.String commandName)
        {
            try
            {
                ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars;
                ESRI.ArcGIS.esriSystem.UID         uid         = new ESRI.ArcGIS.esriSystem.UIDClass();
                uid.Value = commandName;
                ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(uid, false, false);

                if (commandItem != null)
                {
                    commandItem.Execute();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(String.Format("Extensions manager could not be opened: {0}", ex.Message));
            }
        }