/// <summary> /// �����ͼ�����˱仯����ô��ͼ�ؼ��Ͳ��ֿؼ��ĵ�ͼҲӦ�����仯 /// </summary> /// <param name="_NewMap"></param> public void ReplaceMap(IMap _NewMap) { if (_NewMap == null) throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nNew map for replacement is not initialized!"); if (pPageLayoutControl == null || pMapControl == null) throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nEither MapControl or PageLayoutControl are not initialized!"); //create a new instance of IMaps collection which is needed by the PageLayout IMaps pMaps = new Maps(); //add the new map to the Maps collection pMaps.Add(_NewMap); bool bIsMapActive = pIsMapControlactive; //call replace map on the PageLayout in order to replace the focus map //we must call ActivatePageLayout, since it is the control we call 'ReplaceMaps' this.ActivatePageLayout(); pPageLayoutControl.PageLayout.ReplaceMaps(pMaps); //assign the new map to the MapControl pMapControl.Map = _NewMap; //reset the active tools pPageLayoutActiveTool = null; pMapActiveTool = null; //make sure that the last active control is activated if (bIsMapActive) { this.ActivateMap(); pMapControl.ActiveView.Refresh(); } else { this.ActivatePageLayout(); pPageLayoutControl.ActiveView.Refresh(); } }
/// <summary> /// ������Ӧ�ó����ʱ����û�м��ص�ͼ����һ���յĵ�ͼ�����������ؼ��������ͼ����һ���������ܱ���һ�� /// </summary> /// <param name="activateMapFirst">true if the MapControl supposed to be activated first</param> public void BindControls(bool _ActivateMapFirst) { if (pPageLayoutControl == null || pMapControl == null) throw new Exception("ControlsSynchronizer::BindControls:\r\nEither MapControl or PageLayoutControl are not initialized!"); //����һ����ͼʵ�� IMap pNewMap = new MapClass(); pNewMap.Name = "Map"; //����MapsΪ���Ǵ�����һ���࣬��ʾ���ǵ�ͼ�ļ��� IMaps pMaps = new Maps(); //add the new Map instance to the Maps collection pMaps.Add(pNewMap); //call replace map on the PageLayout in order to replace the focus map pPageLayoutControl.PageLayout.ReplaceMaps(pMaps); //assign the new map to the MapControl pMapControl.Map = pNewMap; //reset the active tools pPageLayoutActiveTool = null; pMapActiveTool = null; //make sure that the last active control is activated if (_ActivateMapFirst) this.ActivateMap(); else this.ActivatePageLayout(); }