示例#1
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);
        }
示例#2
0
        private void method_0()
        {
            IPropertySheet sheet;
            IPropertyPage  page;
            IElement       element = this.ielement_0;

            if (element is ITextElement)
            {
                sheet = new frmElementProperty
                {
                    Title = "属性"
                };
                page = new TextSetupCtrl();
                sheet.AddPage(page);
                page = new ElementSizeAndPositionCtrl();
                sheet.AddPage(page);
                if (sheet.EditProperties(element))
                {
                    this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                    this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                }
            }
            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))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                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))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                else if (element is IMapSurroundFrame)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    if ((element as IMapSurroundFrame).MapSurround is INorthArrow)
                    {
                        page = new NorthArrowPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is IScaleBar)
                    {
                        page = new ScaleBarFormatPropertyPage();
                        sheet.AddPage(page);
                        page = new ScaleAndUnitsPropertyPage();
                        sheet.AddPage(page);
                        page = new NumberAndLabelPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is IScaleText)
                    {
                        page = new ScaleTextTextPropertyPage();
                        sheet.AddPage(page);
                        page = new ScaleTextFormatPropertyPage();
                        sheet.AddPage(page);
                    }
                    else if ((element as IMapSurroundFrame).MapSurround is ILegend)
                    {
                        page = new LegendPropertyPage();
                        sheet.AddPage(page);
                        page = new 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))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                else if (element is IFrameElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new ElementGeometryInfoPropertyPage();
                    sheet.AddPage(page);
                    page = new FrameProprtyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                else if (element is IFillShapeElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new FillSymbolPropertyPage();
                    sheet.AddPage(page);
                    page = new ElementGeometryInfoPropertyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                else if (element is ILineElement)
                {
                    sheet = new frmElementProperty
                    {
                        Title = "属性"
                    };
                    page = null;
                    page = new LineSymbolPropertyPage();
                    sheet.AddPage(page);
                    envelope = element.Geometry.Envelope;
                    if (sheet.EditProperties(element))
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
                else if (element is IJTBElement)
                {
                    frmJTBElement element2 = new frmJTBElement
                    {
                        JTBElement = element as IJTBElement
                    };
                    envelope = element.Geometry.Envelope;
                    if (element2.ShowDialog() == DialogResult.OK)
                    {
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, envelope);
                        this.iactiveView_0.GraphicsContainer.UpdateElement(element);
                        this.iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
                    }
                }
            }
            this.ielement_2 = (element as IClone).Clone() as IElement;
        }