private void axMapControl1_OnAfterScreenDraw(object sender, IMapControlEvents2_OnAfterScreenDrawEvent e) { IActiveView pActiveView = axPageLayoutControl1.ActiveView.FocusMap as IActiveView; IDisplayTransformation displayTransformation = pActiveView.ScreenDisplay.DisplayTransformation; displayTransformation.VisibleBounds = axMapControl1.Extent; axPageLayoutControl1.ActiveView.Refresh(); BasicMethod.CopyAndOverwriteMap(axMapControl1, axPageLayoutControl1); }
//listen to MapReplaced evant in order to update the statusbar and the Save menu private void axMapControl1_OnMapReplaced(object sender, IMapControlEvents2_OnMapReplacedEvent e) { //get the current document name from the MapControl m_mapDocumentName = m_mapControl.DocumentFilename; //if there is no MapDocument, diable the Save menu and clear the statusbar if (m_mapDocumentName == string.Empty) { menuSaveDoc.Enabled = false; statusBarXY.Text = string.Empty; } else { //enable the Save manu and write the doc name to the statusbar menuSaveDoc.Enabled = true; statusBarXY.Text = System.IO.Path.GetFileName(m_mapDocumentName); } //IMap pMap = axMapControl1.Map; if (axMapControl1.LayerCount > 0) { //// 当主地图显示控件的地图更换时,鹰眼中的地图也跟随更换 //axMapControl2.Map = new MapClass(); //axMapControl2.ClearLayers(); //// 添加主地图控件中的所有图层到鹰眼控件中 //for (int i = axMapControl1.LayerCount - 1; i >=0 ; i--) //{ // axMapControl2.AddLayer(axMapControl1.get_Layer(i)); //} //// 设置 MapControl 显示范围至数据的全局范围 //// axMapControl2.Extent = axMapControl1.Extent; //axMapControl2.Extent = axMapControl1.Extent; //// 刷新鹰眼控件地图 //axMapControl2.Refresh(); //axMapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); BasicMethod.AddLayersToEagleEye(axMapControl1, axMapControl2); } }
private void axMapControl1_OnViewRefreshed(object sender, IMapControlEvents2_OnViewRefreshedEvent e) { axTOCControl1.Update(); BasicMethod.CopyAndOverwriteMap(axMapControl1, axPageLayoutControl1); }