示例#1
0
        /// <summary>
        /// Activate the PagleLayoutControl and deactivate the MapCotrol
        /// </summary>
        public void ActivatePageLayout()
        {
            try
            {
                if (m_pageLayoutControl == null || m_mapControl == null)
                {
                    throw new Exception(
                              "ControlsSynchronizer::ActivatePageLayout:\r\nEither MapControl or PageLayoutControl are not initialized!");
                }

                //cache the current tool of the MapControl
                if (m_mapControl.CurrentTool != null)
                {
                    m_mapActiveTool = m_mapControl.CurrentTool;
                }

                ////deactivate the MapControl
                m_mapControl.ActiveView.Deactivate();

                ////activate the PageLayoutControl
                m_pageLayoutControl.ActiveView.Activate(m_pageLayoutControl.hWnd);

                ////assign the last active tool that has been used on the PageLayoutControl back as the active tool
                if (m_pageLayoutActiveTool != null)
                {
                    m_pageLayoutControl.CurrentTool = m_pageLayoutActiveTool;
                }

                //IMapFrame focusMapFrame = this.GetFocusMapFrame(this.m_pageLayoutControl.PageLayout);
                //(focusMapFrame.Map as IMapClipOptions).ClipType = esriMapClipType.esriMapClipNone;
                //if (focusMapFrame.Map is IMapAutoExtentOptions)
                //{
                //    (focusMapFrame.Map as IMapAutoExtentOptions).AutoExtentType = esriExtentTypeEnum.esriExtentDefault;
                //}
                //(focusMapFrame.Map as IActiveView).Extent = this.m_mapControl.ActiveView.Extent;
                //if (this.m_pageLayoutActiveTool != null)
                //{
                //    this.m_pageLayoutControl.CurrentTool = this.m_pageLayoutActiveTool;
                //}

                m_IsMapCtrlactive = false;

                //on each of the framework controls, set the Buddy control to the PageLayoutControl
                this.SetBuddies(m_pageLayoutControl.Object);
                _conrolType = GISControlType.PageLayout;
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("ControlsSynchronizer::ActivatePageLayout:\r\n{0}", ex.Message));
            }
        }
示例#2
0
        /// <summary>
        /// Activate the MapControl and deactivate the PagleLayoutControl
        /// </summary>
        public void ActivateMap()
        {
            try
            {
                if (m_pageLayoutControl == null || m_mapControl == null)
                {
                    throw new Exception(
                              "ControlsSynchronizer::ActivateMap:\r\nEither MapControl or PageLayoutControl are not initialized!");
                }

                //cache the current tool of the PageLayoutControl
                if (m_pageLayoutControl.CurrentTool != null)
                {
                    m_pageLayoutActiveTool = m_pageLayoutControl.CurrentTool;
                }

                //deactivate the PagleLayout
                m_pageLayoutControl.ActiveView.Deactivate();

                //activate the MapControl
                m_mapControl.ActiveView.Activate(m_mapControl.hWnd);

                //assign the last active tool that has been used on the MapControl back as the active tool
                if (m_mapActiveTool != null)
                {
                    m_mapControl.CurrentTool = m_mapActiveTool;
                }

                m_IsMapCtrlactive = true;

                //on each of the framework controls, set the Buddy control to the MapControl
                this.SetBuddies(m_mapControl.Object);
                _conrolType = GISControlType.MapControl;
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("ControlsSynchronizer::ActivateMap:\r\n{0}", ex.Message));
            }
        }