Esempio n. 1
0
        private void 属性ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Exception         exception;
            IFillShapeElement pElement;
            IEnvelope         extent;

            if (this.m_OverwindowsLayersType == OverwindowsLayersType.AllLayer)
            {
                OverviewWindowsAllLayerProperty property = new OverviewWindowsAllLayerProperty
                {
                    Map                    = this.m_pMainAvtiveView.FocusMap,
                    OverviewMap            = this.axMapControl1.Map,
                    MapCtrlBackgroundColor = this.axMapControl1.BackColor,
                    StyleGallery           = this.m_pSG,
                    FillSymbol             = this.m_pFillSymbol,
                    ZoomWithMainView       = this.m_ZoomWithMainView
                };
                if (property.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        this.axMapControl1.BackColor = property.MapCtrlBackgroundColor;
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        MessageBox.Show(exception.Message);
                    }
                    this.m_pFillSymbol      = property.FillSymbol;
                    pElement                = this.m_pElement as IFillShapeElement;
                    pElement.Symbol         = this.m_pFillSymbol;
                    this.m_ZoomWithMainView = property.ZoomWithMainView;
                    if (this.m_ZoomWithMainView)
                    {
                        extent = this.axMapControl1.ActiveView.Extent;
                        this.axMapControl1.ActiveView.Extent = this.m_pEnvelope;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    else
                    {
                        if (this.m_ClipBounds != null)
                        {
                            this.axMapControl1.ActiveView.Extent = this.m_ClipBounds.Envelope;
                        }
                        else if (this.m_pMainMapControl.Map.ClipGeometry != null)
                        {
                            this.axMapControl1.ActiveView.Extent = this.m_pMainMapControl.Map.ClipGeometry.Envelope;
                        }
                        else
                        {
                            this.axMapControl1.ActiveView.Extent = this.axMapControl1.ActiveView.FullExtent;
                        }
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    this.DrawRectangle(this.axMapControl1.ActiveView);
                }
            }
            else
            {
                OverviewWindowsProperty property2 = new OverviewWindowsProperty
                {
                    Map                    = this.m_pMainAvtiveView.FocusMap,
                    OverviewMap            = this.axMapControl1.Map,
                    MapCtrlBackgroundColor = this.axMapControl1.BackColor,
                    StyleGallery           = this.m_pSG,
                    FillSymbol             = this.m_pFillSymbol,
                    ZoomWithMainView       = this.m_ZoomWithMainView
                };
                if (property2.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        this.axMapControl1.BackColor = property2.MapCtrlBackgroundColor;
                    }
                    catch (Exception exception2)
                    {
                        exception = exception2;
                        MessageBox.Show(exception.Message);
                    }
                    this.m_pFillSymbol      = property2.FillSymbol;
                    pElement                = this.m_pElement as IFillShapeElement;
                    pElement.Symbol         = this.m_pFillSymbol;
                    this.m_ZoomWithMainView = property2.ZoomWithMainView;
                    if (this.m_ZoomWithMainView)
                    {
                        extent = this.axMapControl1.ActiveView.Extent;
                        this.axMapControl1.ActiveView.Extent = this.m_pEnvelope;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    else
                    {
                        if (this.m_ClipBounds != null)
                        {
                            this.axMapControl1.ActiveView.Extent = this.m_ClipBounds.Envelope;
                        }
                        else if (this.m_pMainMapControl.Map.ClipGeometry != null)
                        {
                            this.axMapControl1.ActiveView.Extent = this.m_pMainMapControl.Map.ClipGeometry.Envelope;
                        }
                        else
                        {
                            this.axMapControl1.ActiveView.Extent = this.axMapControl1.ActiveView.FullExtent;
                        }
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    this.DrawRectangle(this.axMapControl1.ActiveView);
                }
            }
        }
Esempio n. 2
0
        private void OverviewProperty_ItemClick(object sender, ItemClickEventArgs e)
        {
            Exception         exception;
            IFillShapeElement pElement;
            IEnvelope         extent;
            double            num;

            if (this.m_OverwindowsLayersType == OverwindowsLayersType.AllLayer)
            {
                OverviewWindowsAllLayerProperty property = new OverviewWindowsAllLayerProperty
                {
                    Map                    = this.m_pMainMapControl.Map,
                    OverviewMap            = this.axMapControl1.Map,
                    MapCtrlBackgroundColor = this.axMapControl1.BackColor,
                    StyleGallery           = this.m_pSG,
                    FillSymbol             = this.m_pFillSymbol,
                    ZoomWithMainView       = this.m_ZoomWithMainView
                };
                if (property.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        this.axMapControl1.BackColor = property.MapCtrlBackgroundColor;
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        MessageBox.Show(exception.Message);
                    }
                    this.m_pFillSymbol      = property.FillSymbol;
                    pElement                = this.m_pElement as IFillShapeElement;
                    pElement.Symbol         = this.m_pFillSymbol;
                    this.m_ZoomWithMainView = property.ZoomWithMainView;
                    if (this.m_ZoomWithMainView)
                    {
                        extent = this.axMapControl1.ActiveView.Extent;
                        num    = extent.Width / extent.Height;
                        if (this.m_pEnvelope.Width > (this.m_pEnvelope.Height * num))
                        {
                            this.m_pEnvelope.YMin = this.m_pEnvelope.YMax - (this.m_pEnvelope.Width / num);
                        }
                        else
                        {
                            this.m_pEnvelope.XMax = this.m_pEnvelope.XMin + (this.m_pEnvelope.Height * num);
                        }
                        this.axMapControl1.ActiveView.Extent = this.m_pEnvelope;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    else
                    {
                        this.axMapControl1.ActiveView.Extent = this.axMapControl1.ActiveView.FullExtent;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    this.DrawRectangle(this.axMapControl1.ActiveView);
                }
            }
            else
            {
                OverviewWindowsProperty property2 = new OverviewWindowsProperty
                {
                    Map                    = this.m_pMainMapControl.Map,
                    OverviewMap            = this.axMapControl1.Map,
                    MapCtrlBackgroundColor = this.axMapControl1.BackColor,
                    StyleGallery           = this.m_pSG,
                    FillSymbol             = this.m_pFillSymbol,
                    ZoomWithMainView       = this.m_ZoomWithMainView
                };
                if (property2.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        this.axMapControl1.BackColor = property2.MapCtrlBackgroundColor;
                    }
                    catch (Exception exception2)
                    {
                        exception = exception2;
                        MessageBox.Show(exception.Message);
                    }
                    this.m_pFillSymbol      = property2.FillSymbol;
                    pElement                = this.m_pElement as IFillShapeElement;
                    pElement.Symbol         = this.m_pFillSymbol;
                    this.m_ZoomWithMainView = property2.ZoomWithMainView;
                    if (this.m_ZoomWithMainView)
                    {
                        extent = this.axMapControl1.ActiveView.Extent;
                        num    = extent.Width / extent.Height;
                        if (this.m_pEnvelope.Width > (this.m_pEnvelope.Height * num))
                        {
                            this.m_pEnvelope.YMin = this.m_pEnvelope.YMax - (this.m_pEnvelope.Width / num);
                        }
                        else
                        {
                            this.m_pEnvelope.XMax = this.m_pEnvelope.XMin + (this.m_pEnvelope.Height * num);
                        }
                        this.axMapControl1.ActiveView.Extent = this.m_pEnvelope;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    else
                    {
                        this.axMapControl1.ActiveView.Extent = this.axMapControl1.ActiveView.FullExtent;
                        this.axMapControl1.ActiveView.Refresh();
                    }
                    this.DrawRectangle(this.axMapControl1.ActiveView);
                }
            }
        }