예제 #1
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            //get a reference to the MapControl and the PageLayoutControl
            //取得MapControl和PageLayoutControl的引用
            m_mapControl        = (IMapControl3)this.mainMapControl.Object;
            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl.Object;

            //initialize the controls synchronization calss
            //初始化controls synchronization calss
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //bind the controls together (both point at the same map) and set the MapControl as the active control
            //把MapControl和PageLayoutControl帮顶起来(两个都指向同一个Map),然后设置MapControl为活动的Control
            m_controlsSynchronizer.BindControls(true);

            //add the framework controls (TOC and Toolbars) in order to synchronize then when the
            //active control changes (call SetBuddyControl)
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object);
            m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl.Object);

            //add the Open Map Document command onto the toolbar
            //OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
            //axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);

            GalleryDropDown skins = new GalleryDropDown();

            skins.Ribbon = ribbonControl1;
            DevExpress.XtraBars.Helpers.SkinHelper.InitSkinGalleryDropDown(skins);
            iPaintStyle.DropDownControl = skins;
        }
예제 #2
0
        private void MainForm1_Load(object sender, EventArgs e)
        {
            try
            {
                m_mapControl        = (IMapControl3)MapControl.Object;
                m_pageLayoutControl = (IPageLayoutControl2)PageLayoutControl.Object;

                //initialize the controls synchronization class
                m_controlsSynchronizer = new GenericTools.SynchronizerTools.ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

                //bind the controls together (both point at the same map) and set the MapControl as the active control
                m_controlsSynchronizer.BindControls(true);

                m_controlsSynchronizer.AddFrameworkControl(TOCControl.Object);

                m_controlsSynchronizer.ActivateMap();
                panelLayoutView.Visible = false;
                panelDataView.Visible   = true;

                if (File.Exists("MXD/LoadingDocument.mxd"))
                {
                    m_mapControl.LoadMxFile("MXD/LoadingDocument.mxd");
                }
            }
            catch
            {
                lblCoordinate.Text = "اشکال در بارگذاری نرم افزار";
            }
        }
예제 #3
0
        private void AeMap_Load(object sender, EventArgs e)
        {
            sMapUnits           = "Unknown";
            m_mapControl        = (IMapControl3)this.axMapControl1.Object;
            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;

            //初始化controls synchronization class
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //把MapControl和PageLayoutControl绑定起来(两个都指向同一个Map),然后设置MapControl为活动的Control
            m_controlsSynchronizer.BindControls(true);

            //为了在切换MapControl和PageLayoutControl视图同步,要添加Framework Control
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl1.Object);

            //添加打开命令按钮到工具条
            OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);

            axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);

            //初始化菜单创建
            m_menuMap   = new ToolbarMenuClass();
            m_menuLayer = new ToolbarMenuClass();

            //添加自定义菜单项到TOCCOntrol的Map菜单中
            //打开文档菜单
            m_menuMap.AddItem(new OpenNewMapDocument(m_controlsSynchronizer), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);
            //添加数据菜单
            m_menuMap.AddItem(new ControlsAddDataCommandClass(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText);
            //打开全部图层菜单
            m_menuMap.AddItem(new LayerVisibility(), 1, 2, false, esriCommandStyles.esriCommandStyleTextOnly);
            //关闭全部图层菜单
            m_menuMap.AddItem(new LayerVisibility(), 2, 3, false, esriCommandStyles.esriCommandStyleTextOnly);
            //以二级菜单的形式添加内置的“选择”菜单
            m_menuMap.AddSubMenu("esriControls.ControlsFeatureSelectionMenu", 4, true);
            //以二级菜单的形式添加内置的“地图浏览”菜单
            m_menuMap.AddSubMenu("esriControls.ControlsMapViewMenu", 5, true);
            //添加自定义菜单项到TOCControl的图层菜单中
            m_menuLayer = new ToolbarMenuClass();
            //添加“移除图层”菜单项
            m_menuLayer.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            //添加“放大到整个图层”菜单项
            m_menuLayer.AddItem(new ZoomToLayer(), -1, 1, true, esriCommandStyles.esriCommandStyleTextOnly);
            //设置菜单的Hook
            m_menuLayer.SetHook(m_mapControl);
            m_menuMap.SetHook(m_mapControl);

            m_tocControl = (ITOCControl2)this.axTOCControl1.Object;
        }
예제 #4
0
        /// <summary>
        /// 打开地图文档 Mxd 命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Open_Click(object sender, EventArgs e)
        {
            if (this.axMapControl1.LayerCount > 0)
            {
                DialogResult result = MessageBox.Show("是否保存当前地图?", "警告", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                if (result == DialogResult.Yes)
                {
                    this.Save_Click(null, null);
                }
            }
            OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);

            openMapDoc.OnCreate(m_controlsSynchronizer.MapControl.Object);
            openMapDoc.OnClick();

            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
        }
        /// <summary>
        /// Form.Load method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, System.EventArgs e)
        {
            //get a reference to the MapControl and the PageLayoutControl
            m_mapControl        = (IMapControl3)axMapControl1.Object;
            m_pageLayoutControl = (IPageLayoutControl2)axPageLayoutControl1.Object;

            //initialize the controls synchronization class
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //bind the controls together (both point at the same map) and set the MapControl as the active control
            m_controlsSynchronizer.BindControls(true);

            //add the framework controls (TOC and Toolbars) in order to synchronize then when the
            //active control changes (call SetBuddyControl)
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object);
            m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);

            //add the Open Map Document command onto the toolbar
            OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);

            axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);
        }
    /// <summary>
    /// Form.Load method
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void frmMain_Load(object sender, System.EventArgs e)
    {
      //get a reference to the MapControl and the PageLayoutControl
      m_mapControl = (IMapControl3)axMapControl1.Object;
      m_pageLayoutControl = (IPageLayoutControl2)axPageLayoutControl1.Object;

      //initialize the controls synchronization class
      m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

      //bind the controls together (both point at the same map) and set the MapControl as the active control
      m_controlsSynchronizer.BindControls(true);

      //add the framework controls (TOC and Toolbars) in order to synchronize then when the
      //active control changes (call SetBuddyControl)
      m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
      m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object);
      m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);

      //add the Open Map Document command onto the toolbar
      OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
      axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);
    }
예제 #7
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            IAoInitialize m_aoinitialize = new AoInitializeClass();
            m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);

            //get a reference to the MapControl and the PageLayoutControl
            //取得MapControl和PageLayoutControl的引用
            m_mapControl = (IMapControl3)this.mainMapControl.Object;
            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl.Object;

            //initialize the controls synchronization calss
            //初始化controls synchronization calss
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //bind the controls together (both point at the same map) and set the MapControl as the active control
            //把MapControl和PageLayoutControl帮顶起来(两个都指向同一个Map),然后设置MapControl为活动的Control
            m_controlsSynchronizer.BindControls(true);

            //add the framework controls (TOC and Toolbars) in order to synchronize then when the
            //active control changes (call SetBuddyControl)
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object);
            m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl.Object);

            //add the Open Map Document command onto the toolbar
            //OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
            //axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);
        }