public void ReplaceMap(IMap newMap) { if (newMap == null) throw new Exception("ControlsSynchronizer::ReplaceMap\r\n��Mapû�г�ʼ��!"); if (m_pageLayoutControl == null || m_mapControl == null) throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nMapControl��PageLayoutControlû�г�ʼ��!"); //����һ����ͼ����IMaps���� IMaps maps = new Maps(); //����Map��ӵ�Maps���� maps.Add(newMap); bool bIsMapActive = m_IsMapCtrlactive; //ʹPageLayoutControl���ڼ���״̬���ܵ���ReplaceMaps���� this.ActivatePageLayout(); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); //��Map���ݸ�MapControl m_mapControl.Map = newMap; //��֤һ����ؼ����ڼ���״̬ if (bIsMapActive) { this.ActivateMap(); m_mapControl.ActiveView.Refresh(); } else { this.ActivatePageLayout(); m_pageLayoutControl.ActiveView.Refresh(); } }
/// <summary> /// ��MapControl��PageLayoutControlͨ��ͬһ������Map���а� /// </summary> /// <param name="activateMapFirst">���MapControl��ΪĬ�ϻ�ؼ�����ΪTrue</param> public void BindControls(bool activateMapFirst) { if (m_pageLayoutControl == null || m_mapControl == null) throw new Exception("ControlsSynchronizer::BindControls:\r\nMapControl��PageLayoutControlû�г�ʼ��!"); //����һ��Map���� IMap newMap = new MapClass(); newMap.Name = "��ͼ"; //����һ����ͼ����IMaps���� IMaps maps = new Maps(); maps.Add(newMap); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); m_mapControl.Map = newMap; if (activateMapFirst) this.ActivateMap(); else this.ActivatePageLayout(); }