/// <summary> /// pageLayout改变事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void axPageLayoutControl1_OnPageLayoutReplaced(object sender, IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { if (axMapControl1.LayerCount == 0) { //this.presenter.copyToMapControl(); } }
private void axPageLayoutControl_OnPageLayoutReplaced(object sender, IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { IMap focusMap = this.axPageLayoutControl.ActiveView.FocusMap; this.axMapControl.Map = focusMap; if (this.m_IsMapCtrlactive) { this.ActivateMap(); this.axMapControl.ActiveView.Refresh(); } else { this.ActivatePageLayout(); this.axPageLayoutControl.ActiveView.Refresh(); } }
private void axPageLayoutControl_OnPageLayoutReplaced(object sender, IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { int num; IMap focusMap = this.axPageLayoutControl.ActiveView.FocusMap; this.axMapControl.Map.ClearLayers(); (this.axMapControl.Map as IGraphicsContainer).DeleteAllElements(); (this.axMapControl.Map as ITableCollection).RemoveAllTables(); this.axMapControl.Map.ClearLayers(); (this.axMapControl.Map as IActiveView).ContentsChanged(); this.axMapControl.Map.MapUnits = focusMap.MapUnits; this.axMapControl.Map.SpatialReferenceLocked = false; this.axMapControl.Map.SpatialReference = focusMap.SpatialReference; this.axMapControl.Map.Name = focusMap.Name; for (num = 0; num < focusMap.LayerCount; num++) { ILayer layer = focusMap.get_Layer(num); this.axMapControl.AddLayer(layer, num); } IGraphicsContainer container = focusMap as IGraphicsContainer; container.Reset(); IElement element = container.Next(); int zorder = 0; while (element != null) { (this.axMapControl.Map as IGraphicsContainer).AddElement(element, zorder); zorder++; element = container.Next(); } ITableCollection tables = focusMap as ITableCollection; for (num = 0; num < tables.TableCount; num++) { (this.axMapControl.Map as ITableCollection).AddTable(tables.get_Table(num)); } this.axMapControl.ActiveView.Extent = (focusMap as IActiveView).Extent; this.axMapControl.ActiveView.Refresh(); }
private void axPageLayoutControl1_OnPageLayoutReplaced(object sender, IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { //Get the IActiveView of the focus map in the PageLayoutControl IActiveView activeView = axPageLayoutControl1.ActiveView.FocusMap as IActiveView; //Trap the ITranformEvents of the PageLayoutCntrol's focus map visBoundsUpdatedE = new ITransformEvents_VisibleBoundsUpdatedEventHandler(OnVisibleBoundsUpdated); IDisplayTransformation displayTransformation = activeView.ScreenDisplay.DisplayTransformation; //Start listening to the transform events interface m_transformEvents = (ITransformEvents_Event)displayTransformation; //Start listening to the VisibleBoundsUpdated method on ITransformEvents interface m_transformEvents.VisibleBoundsUpdated += visBoundsUpdatedE; //Get the extent of the focus map m_Envelope = activeView.Extent; //Load the same pre-authored map document into the MapControl axMapControl1.LoadMxFile(axPageLayoutControl1.DocumentFilename, null, null); //Set the extent of the MapControl to the full extent of the data axMapControl1.Extent = axMapControl1.FullExtent; }
private void axPageLayoutControl1_OnPageLayoutReplaced(object sender, IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { }