Esempio n. 1
0
        public void CopyMapToPageLayOutDataFrameforPrint(IMap MapControlOfMap)
        {
            this.m_OldMap = MapControlOfMap;
            IGraphicsContainerSelect graphicsContainer =
                this.axPageLayoutControl1.ActiveView.GraphicsContainer as IGraphicsContainerSelect;
            IElement  element = null;
            IMapFrame frame   = null;

            if (graphicsContainer.ElementSelectionCount <= 0)
            {
                this.CopyMapToPageLayOutforPrint(MapControlOfMap);
            }
            else
            {
                for (int i = 0; i < graphicsContainer.ElementSelectionCount; i++)
                {
                    element = graphicsContainer.SelectedElement(i);
                    if (element is IMapFrame)
                    {
                        frame = element as IMapFrame;
                        break;
                    }
                }
                if (frame != null)
                {
                    SimpleLineSymbolClass class2 = new SimpleLineSymbolClass();
                    IRgbColor             color  = new RgbColorClass
                    {
                        Red   = 255,
                        Green = 255,
                        Blue  = 255
                    };
                    class2.Color = color;
                    ISymbolBorder border = new SymbolBorderClass
                    {
                        LineSymbol = class2
                    };
                    frame.Border = border;
                    IObjectCopy copy      = new ObjectCopyClass();
                    object      pInObject = MapControlOfMap;
                    object      obj3      = copy.Copy(pInObject);
                    object      map       = frame.Map;
                    copy.Overwrite(obj3, ref map);
                    this.fullPageLayerOut(this.axPageLayoutControl1.ActiveView.FocusMap,
                                          (MapControlOfMap as IActiveView).Extent);
                    this.axPageLayoutControl1.ActiveView.Refresh();
                }
                else
                {
                    this.CopyMapToPageLayOutforPrint(MapControlOfMap);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 改变要素属性
        /// </summary>
        /// <returns></returns>
        public bool ChangeElement(object sender, IPageLayoutControlEvents_OnDoubleClickEvent e)
        {
            IGraphicsContainer pGraphicsCon;

            pGraphicsCon = this.mainPage.PageLayout as IGraphicsContainer;
            pGraphicsCon.Reset();
            IGraphicsContainerSelect pGraSelect = this.mainPage.PageLayout as IGraphicsContainerSelect;
            IElement          pElement          = pGraSelect.SelectedElement(0);
            IMapSurroundFrame pMapSurroundFrame = null;

            if (pElement is IMapSurroundFrame)
            {
                pMapSurroundFrame = pElement as IMapSurroundFrame;
            }
            IGeometry geo = pElement.Geometry;

            # region 文本
            if (pElement is ITextElement)
Esempio n. 3
0
        private bool method_1()
        {
            IGraphicsContainerSelect graphicsContainerSelect = this.GetSelection();
            bool result;

            if (graphicsContainerSelect.ElementSelectionCount == 0)
            {
                result = false;
            }
            else
            {
                IElement element = graphicsContainerSelect.SelectedElement(0);
                IEditElementPropertiesOperation editElementPropertiesOperation = new EditElementPropertiesOperation();
                editElementPropertiesOperation.ActiveView = this._context.ActiveView;
                editElementPropertiesOperation.Element    = element;
                if (!(element is IOleFrame) && ElementChangeEvent.IsFireElementPropertyEditEvent)
                {
                    ElementChangeEvent.EditElementProperty(element);
                    result = true;
                }
                else
                {
                    if (element is ITextElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new TextSetupCtrl();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new ElementSizeAndPositionCtrl();
                        propertySheet.AddPage(propertyPage);
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IFractionTextElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new FractionTextSymbolPage();
                        (propertyPage as FractionTextSymbolPage).ActiveView = this._context.ActiveView;
                        propertySheet.AddPage(propertyPage);
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IMapFrame)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "数据框 属性";
                        IPropertyPage propertyPage = new MapGeneralInfoCtrl();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new MapCoordinateCtrl();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new FrameProprtyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IPictureElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "图像 属性";
                        IPropertyPage propertyPage = new PicturePropertyPage();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new FrameProprtyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IMapSurroundFrame)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage;
                        if ((element as IMapSurroundFrame).MapSurround is INorthArrow)
                        {
                            propertyPage = new NorthArrowPropertyPage();
                            propertySheet.AddPage(propertyPage);
                        }
                        else if ((element as IMapSurroundFrame).MapSurround is IScaleBar)
                        {
                            propertyPage = new ScaleBarFormatPropertyPage();
                            propertySheet.AddPage(propertyPage);
                            propertyPage = new ScaleAndUnitsPropertyPage();
                            propertySheet.AddPage(propertyPage);
                            propertyPage = new NumberAndLabelPropertyPage();
                            propertySheet.AddPage(propertyPage);
                        }
                        else if ((element as IMapSurroundFrame).MapSurround is IScaleText)
                        {
                            propertyPage = new ScaleTextTextPropertyPage();
                            propertySheet.AddPage(propertyPage);
                            propertyPage = new ScaleTextFormatPropertyPage();
                            propertySheet.AddPage(propertyPage);
                        }
                        else if ((element as IMapSurroundFrame).MapSurround is ILegend)
                        {
                            propertyPage = new LegendPropertyPage();
                            propertySheet.AddPage(propertyPage);
                            propertyPage = new LegendItemPropertyPage();
                            propertySheet.AddPage(propertyPage);
                        }
                        propertyPage = new FrameProprtyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope  = element.Geometry.Envelope;
                        IElement  arg_43A_0 = (element as IClone).Clone() as IElement;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IFrameElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new ElementGeometryInfoPropertyPage();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new FrameProprtyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IFillShapeElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new FillSymbolPropertyPage();
                        propertySheet.AddPage(propertyPage);
                        propertyPage = new ElementGeometryInfoPropertyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is ILineElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new LineSymbolPropertyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IMarkerElement)
                    {
                        IPropertySheet propertySheet = new frmElementProperty();
                        propertySheet.Title = "属性";
                        IPropertyPage propertyPage = new MarkerElementPropertyPage();
                        propertySheet.AddPage(propertyPage);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (propertySheet.EditProperties(element))
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    else if (element is IJTBElement)
                    {
                        frmJTBElement frmJTBElement = new frmJTBElement();
                        frmJTBElement.JTBElement = (element as IJTBElement);
                        IEnvelope envelope = element.Geometry.Envelope;
                        if (frmJTBElement.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            IActiveView activeView = this._context.ActiveView;
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                            activeView.GraphicsContainer.UpdateElement(element);
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                            this._context.OperationStack.Do(editElementPropertiesOperation);
                        }
                    }
                    result = true;
                }
            }
            return(result);
        }
Esempio n. 4
0
        private bool method_1()
        {
            IPropertySheet           sheet;
            IPropertyPage            page;
            IActiveView              activeView;
            IGraphicsContainerSelect select = this.method_0();

            if (select.ElementSelectionCount == 0)
            {
                return(false);
            }
            IElement element = select.SelectedElement(0);
            IEditElementPropertiesOperation operation = new EditElementPropertiesOperation
            {
                ActiveView = this._hookHelper.ActiveView,
                Element    = element
            };

            if (element is ITextElement)
            {
                sheet = new frmElementProperty
                {
                    Title = "属性"
                };
                page = new TextSetupCtrl();
                sheet.AddPage(page);
                page = new UI.ElementSizeAndPositionCtrl();
                sheet.AddPage(page);
                if (sheet.EditProperties(element))
                {
                    activeView = this._hookHelper.ActiveView;
                    activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    activeView.GraphicsContainer.UpdateElement(element);
                    activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    this._hookHelper.OperationStack.Do(operation);
                }
            }
            else
            {
                IEnvelope envelope;
                if (element is IMapFrame)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "数据框 属性"
                    };
                    page = null;
                    page = new MapGeneralInfoCtrl();
                    sheet.AddPage(page);
                    page = new MapCoordinateCtrl();
                    sheet.AddPage(page);
                    page = new FrameProprtyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is IPictureElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "图像 属性"
                    };
                    page = null;
                    page = new PicturePropertyPage();
                    sheet.AddPage(page);
                    page = new FrameProprtyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is IMapSurroundFrame)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    if ((element as IMapSurroundFrame).MapSurround is INorthArrow)
                    {
                        page = new UI.NorthArrowPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is IScaleBar)
                    {
                        page = new UI.ScaleBarFormatPropertyPage();
                        sheet.AddPage(page);
                        page = new UI.ScaleAndUnitsPropertyPage();
                        sheet.AddPage(page);
                        page = new UI.NumberAndLabelPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is IScaleText)
                    {
                        page = new UI.ScaleTextTextPropertyPage();
                        sheet.AddPage(page);
                        page = new UI.ScaleTextFormatPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is ILegend)
                    {
                        page = new UI.LegendPropertyPage();
                        sheet.AddPage(page);
                        page = new UI.LegendItemPropertyPage();
                        sheet.AddPage(page);
                    }
                    page = new FrameProprtyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    IElement element1 = (element as IClone).Clone() as IElement;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is IFrameElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new UI.ElementGeometryInfoPropertyPage();
                    sheet.AddPage(page);
                    page = new FrameProprtyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is IFillShapeElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new UI.FillSymbolPropertyPage();
                    sheet.AddPage(page);
                    page = new UI.ElementGeometryInfoPropertyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is ILineElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new UI.LineSymbolPropertyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
                else if (element is IMarkerElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new UI.MarkerElementPropertyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        activeView = this._hookHelper.ActiveView;
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        activeView.GraphicsContainer.UpdateElement(element);
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this._hookHelper.OperationStack.Do(operation);
                    }
                }
            }
            return(true);
        }