private void Form1_Load(object sender, System.EventArgs e)
        {
            //Set buddy control
            axToolbarControl1.SetBuddyControl(axMapControl1.Object);

            //Add control command items to the ToolbarControl
            axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
            axToolbarControl1.AddItem("esriControls.ControlsMapZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly);
            axToolbarControl1.AddItem("esriControls.ControlsMapZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
            axToolbarControl1.AddItem("esriControls.ControlsMapPanTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
            //Add extension command items to the ToolbarControl
            axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.SetZoomFactor", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconAndText);
            axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.ZoomIn", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconAndText);
            axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.ZoomOut", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconAndText);

            //Get the extension manager admin
            m_ExtensionManagerAdmin = (IExtensionManagerAdmin) new ExtensionManagerClass();

            //Add the extension to the extension manager
            UID uID = new UIDClass();

            uID.Value = "ZoomFactorExtensionCSharp.ZoomExtension";
            object obj = new object();

            m_ExtensionManagerAdmin.AddExtension(uID, ref obj);
        }
Пример #2
0
        private bool EnablePublisherExtension()
        {
            bool checkedOutOK = false;

            try
            {
                IExtensionManager extMgr = new ExtensionManagerClass();

                IExtensionManagerAdmin extAdmin = (IExtensionManagerAdmin)extMgr;

                UID uid = new UID();
                uid.Value = "esriPublisherUI.Publisher";
                object obj = 0;
                extAdmin.AddExtension(uid, ref obj);

                IExtensionConfig extConfig = (IExtensionConfig)extMgr.FindExtension(uid);

                if ((!(extConfig.State == esriExtensionState.esriESUnavailable)))
                {
                    //This checks on the extension
                    extConfig.State = esriExtensionState.esriESEnabled;
                    checkedOutOK    = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Publisher extension has failed to check out.", "Error");
            }

            return(checkedOutOK);
        }
		private void Form1_Load(object sender, System.EventArgs e)
		{
			//Set buddy control
			axToolbarControl1.SetBuddyControl(axMapControl1.Object);

			//Add control command items to the ToolbarControl
			axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand",-1,-1,false,0,esriCommandStyles.esriCommandStyleIconOnly);
			axToolbarControl1.AddItem("esriControls.ControlsMapZoomInTool",-1,-1,true,0,esriCommandStyles.esriCommandStyleIconOnly);
			axToolbarControl1.AddItem("esriControls.ControlsMapZoomOutTool",-1,-1,false,0,esriCommandStyles.esriCommandStyleIconOnly);
			axToolbarControl1.AddItem("esriControls.ControlsMapPanTool",-1,-1,false,0,esriCommandStyles.esriCommandStyleIconOnly);
			//Add extension command items to the ToolbarControl
			axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.SetZoomFactor",-1,-1,true,0,esriCommandStyles.esriCommandStyleIconAndText);
			axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.ZoomIn",-1,-1,true,0,esriCommandStyles.esriCommandStyleIconAndText);
			axToolbarControl1.AddItem("ZoomFactorExtensionCSharp.ZoomOut",-1,-1,true,0,esriCommandStyles.esriCommandStyleIconAndText);

			//Get the extension manager admin
			m_ExtensionManagerAdmin = (IExtensionManagerAdmin) new ExtensionManagerClass();

			//Add the extension to the extension manager
			UID uID = new UIDClass();
			uID.Value = "ZoomFactorExtensionCSharp.ZoomExtension";
			object obj = new object();
			m_ExtensionManagerAdmin.AddExtension(uID, ref obj);
		}