/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { IActiveView pActiveView = (IActiveView)m_PageLayOutControl.PageLayout; IMap pMap = pActiveView.FocusMap; IGraphicsContainer pGraphicsContainer = (IGraphicsContainer)pActiveView; IMapFrame pMapFrame = (IMapFrame)pGraphicsContainer.FindFrame(pMap); IStyleSelector pStyleSelector = new BackgroundSelectorClass(); bool m_bOK = pStyleSelector.DoModal(m_PageLayOutControl.hWnd); if (!m_bOK) { return; } IBackground pBackground = (IBackground)pStyleSelector.GetStyle(0); pMapFrame.Background = pBackground; m_PageLayOutControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { // TODO: Add ChangeFrameBackGround.OnClick implementation // IActiveView pActiveView; //IGraphicsContainer pGraphicsContainer; // IMap pMap; // pActiveView = m_pageLayoutControl.PageLayout as IActiveView; /// pMap = pActiveView.FocusMap; // pGraphicsContainer = pActiveView as IGraphicsContainer; // pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame; // IStyleSelector pStyleSelector; // pStyleSelector = new BackgroundSelectorClass(); // // bool m_bOK; // m_bOK = pStyleSelector.DoModal(m_pageLayoutControl.hWnd); //(cancel) // if (!m_bOK) return; // IBackground pBackground; // // pBackground = pStyleSelector.GetStyle(0) as IBackground; // if (m_element is IMapFrame) { m_MapFrame = m_element as IMapFrame; } frmLegendItemSymbol frmBackGround = new frmLegendItemSymbol(); ESRI.ArcGIS.Controls.esriSymbologyStyleClass styleClass = esriSymbologyStyleClass.esriStyleClassBackgrounds; IStyleGalleryItem pStyleGalleryItem = frmBackGround.GetItem(styleClass); if (pStyleGalleryItem != null) { m_MapFrame.Background = (IBackground)pStyleGalleryItem.Item; } else { return; } // pMapFrame.Background = pBackground; // m_PageLayoutControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); m_PageLayoutControl.ActiveView.Refresh(); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { // TODO: Add ChangeFrameShadow.OnClick implementation /* IActiveView pActiveView; * IGraphicsContainer pGraphicsContainer; * IMapFrame pMapFrame; * IMap pMap; * pActiveView = m_pageLayoutControl.PageLayout as IActiveView; * pMap = pActiveView.FocusMap; * pGraphicsContainer = pActiveView as IGraphicsContainer; * pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame; * IStyleSelector pStyleSelector; * pStyleSelector = new ShadowSelectorClass(); * // * bool m_bOK; * m_bOK = pStyleSelector.DoModal(m_pageLayoutControl.hWnd); * //cancel * if (!m_bOK) return; * IShadow pShadow; * //IShadow * pShadow = pStyleSelector.GetStyle(0) as IShadow; * IFrameProperties pFrameProperties; * pFrameProperties = pMapFrame as IFrameProperties; * //*/ IElementProperties pElementProties = m_element as IElementProperties; if (m_element is IMapFrame) { m_MapFrame = m_element as IMapFrame; } else if (pElementProties.Type == "Map Surround Frame") { IMapSurroundFrame pMapSurrounFrame = pElementProties as IMapSurroundFrame; if (pMapSurrounFrame.MapSurround.Name == "Legend") { //ILegend pLegend = m_element as ILegend; //为了改变边框,背景,阴影等样式 //IMapSurround pmapSurd = (IMapSurround)pLegend; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "Alternating Scale Bar") { // IScaleBar pScaleBatr = m_element as IScaleBar; // IMapSurround pmapSurd = (IMapSurround)pScaleBatr ; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "Scale Text") { //IScaleText pScaleText = m_element as IScaleText; // IMapSurround pmapSurd = (IMapSurround)pScaleText; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; //pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "North Arrow") { // INorthArrow pNorthArrow = m_element as INorthArrow; // IMapSurround pmapSurd = (IMapSurround)pNorthArrow ; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } } IFrameProperties pFrameProperties; pFrameProperties = m_MapFrame as IFrameProperties; frmLegendItemSymbol frmBackGround = new frmLegendItemSymbol(); ESRI.ArcGIS.Controls.esriSymbologyStyleClass styleClass = esriSymbologyStyleClass.esriStyleClassShadows; IStyleGalleryItem pStyleGalleryItem = frmBackGround.GetItem(styleClass); if (pStyleGalleryItem != null) { pFrameProperties.Shadow = (IShadow )pStyleGalleryItem.Item; } else { return; } // pFrameProperties.Shadow = pShadow; m_pageLayoutControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); m_pageLayoutControl.ActiveView.Refresh(); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { // TODO: Add ChangeFrameBorder.OnClick implementation /* * IActiveView pActiveView; * IGraphicsContainer pGraphicsContainer; * IMapFrame pMapFrame; * IMap pMap; * pActiveView = m_pageLayoutControl.PageLayout as IActiveView; * pMap = pActiveView.FocusMap; * pGraphicsContainer = pActiveView as IGraphicsContainer; * pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame; * IStyleSelector pStyleSelector; * // * pStyleSelector = new BorderSelectorClass(); * bool m_bOK; * m_bOK = pStyleSelector.DoModal(m_pageLayoutControl.hWnd); * if (!m_bOK) return; * IBorder pBorder; * pBorder = pStyleSelector.GetStyle(0) as IBorder; // IBorder */ IElementProperties pElementProties = m_element as IElementProperties; if (m_element is IMapFrame) { m_MapFrame = m_element as IMapFrame; } else if (pElementProties.Type == "Map Surround Frame") { IMapSurroundFrame pMapSurrounFrame = pElementProties as IMapSurroundFrame; if (pMapSurrounFrame.MapSurround.Name == "Legend") { //ILegend pLegend = m_element as ILegend; //为了改变边框,背景,阴影等样式 //IMapSurround pmapSurd = (IMapSurround)pLegend; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "Alternating Scale Bar") { // IScaleBar pScaleBatr = m_element as IScaleBar; // IMapSurround pmapSurd = (IMapSurround)pScaleBatr ; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "Scale Text") { //IScaleText pScaleText = m_element as IScaleText; // IMapSurround pmapSurd = (IMapSurround)pScaleText; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; //pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } else if (pMapSurrounFrame.MapSurround.Name == "North Arrow") { // INorthArrow pNorthArrow = m_element as INorthArrow; // IMapSurround pmapSurd = (IMapSurround)pNorthArrow ; IMapSurroundFrame pmapSurdFrm = pMapSurrounFrame; // pmapSurdFrm.MapSurround = pmapSurd; IMapFrame pMapFrm = new MapFrameClass(); pMapFrm = pmapSurdFrm.MapFrame; m_MapFrame = pMapFrm; } } frmLegendItemSymbol frmBackGround = new frmLegendItemSymbol(); ESRI.ArcGIS.Controls.esriSymbologyStyleClass styleClass = esriSymbologyStyleClass.esriStyleClassBorders; IStyleGalleryItem pStyleGalleryItem = frmBackGround.GetItem(styleClass); if (pStyleGalleryItem != null) { m_MapFrame.Border = (IBorder )pStyleGalleryItem.Item; } else { return; } m_pageLayoutControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); }
private void axPageLayoutControl1_OnDoubleClick(object sender, IPageLayoutControlEvents_OnDoubleClickEvent e) { if (m_element != null) { IElementProperties pElementProp = m_element as IElementProperties; if (pElementProp.Type == "Text") { ITextElement pTextElement = pElementProp as ITextElement; frmTextSymbol frmText = new frmTextSymbol(ref pTextElement); frmText.ShowDialog(); pElementProp = pTextElement as IElementProperties; m_pageLayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphicSelection, null, null); m_pageLayoutControl.ActiveView.Refresh(); } else if (pElementProp.Type == "Map Surround Frame") { IMapSurroundFrame pMapSurrounFrame = pElementProp as IMapSurroundFrame; if (pMapSurrounFrame.MapSurround.Name == "Legend") { frmLegendWizard frmLegedWizard = new frmLegendWizard(m_Map, m_pageLayoutControl, pMapSurrounFrame); frmLegedWizard.ShowDialog(); //修改图例属性 } else if (pMapSurrounFrame.MapSurround.Name == "Alternating Scale Bar" || pMapSurrounFrame.MapSurround.Name == "Hollow Scale Bar" || pMapSurrounFrame.MapSurround.Name == "Double lternating Scale Bar" || pMapSurrounFrame.MapSurround.Name == "Scale Line" || pMapSurrounFrame.MapSurround.Name == "Single Division Scale Bar" || pMapSurrounFrame.MapSurround.Name == "Stepped Scale Line") { ESRI.ArcGIS.Controls.esriSymbologyStyleClass styleClass = esriSymbologyStyleClass.esriStyleClassScaleBars; frmLegendItemSymbol frmScaleBar = new frmLegendItemSymbol(); IStyleGalleryItem pstyGallertItem = frmScaleBar.GetItem(styleClass);//获取样式 IScaleBar pscaleBar = pMapSurrounFrame.MapSurround as IScaleBar; esriUnits punits = pscaleBar.Units; if (pstyGallertItem != null) { pscaleBar = (IScaleBar)pstyGallertItem.Item; } else { return; } pscaleBar.Map = m_pageLayoutControl.ActiveView.FocusMap; //重新设置比例尺依附的地图及单位 pscaleBar.Units = punits; pscaleBar.UseMapSettings(); pscaleBar.Refresh(); pMapSurrounFrame.MapSurround = pscaleBar as IMapSurround; //旧的比例尺样式转换为新的比例尺样式 m_pageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics, null, null); //刷新 } else if (pMapSurrounFrame.MapSurround.Name == "Scale Text") { frmLegendItemSymbol frmTextScal = new frmLegendItemSymbol(); IStyleGalleryItem pStyGalleryItem = frmTextScal.GetItem(esriSymbologyStyleClass.esriStyleClassScaleTexts); IScaleText pScaleText = pMapSurrounFrame.MapSurround as IScaleText; esriUnits pUnits = pScaleText.MapUnits; if (pStyGalleryItem != null) { pScaleText = (IScaleText)pStyGalleryItem.Item; } else { return; } pScaleText.Map = m_pageLayoutControl.ActiveView.FocusMap; pScaleText.MapUnits = pScaleText.MapUnits; pMapSurrounFrame.MapSurround = pScaleText as IMapSurround; m_pageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics, null, null); } else if (pMapSurrounFrame.MapSurround.Name.Trim() == "North Arrow") { INorthArrow northArrow = pMapSurrounFrame.MapSurround as INorthArrow; frmNorthArrowSymbol frmNorthArrow = new frmNorthArrowSymbol(); IStyleGalleryItem pstyGallertItem = frmNorthArrow.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows);; if (pstyGallertItem != null) { northArrow = (INorthArrow)pstyGallertItem.Item; northArrow.CalibrationAngle = frmNorthArrow.Angle(); } else { return; } pMapSurrounFrame.MapSurround = (IMapSurround)northArrow; m_pageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics, null, null); } } } }