Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            m_TitleElement      = new TextElementClass();
            m_TitleElement.Text = this.textBoxTitle.Text;
            frmTextSymbol frmtext = new frmTextSymbol(ref m_TitleElement);

            frmtext.ShowDialog();
            this.textBoxTitle.Text = m_TitleElement.Text;
        }
Пример #2
0
        private void btnTextSymbol_Click(object sender, EventArgs e)
        {
            ITextElement textElement = new TextElementClass();

            textElement.Symbol = pTextSymbol;
            textElement.Text   = "图层名";
            frmTextSymbol frmText = new frmTextSymbol(ref textElement);

            frmText.ShowDialog();
            pTextSymbol = textElement.Symbol; //这里是设置标注的字体样式
        }
Пример #3
0
        private void btnSymbol_Click(object sender, EventArgs e)
        { //图例的大标题字体;
            m_legend.Title       = this.textBox1.Text;
            plegendFormat        = m_legend.Format;
            pTitleElement        = new TextElementClass();
            pTitleElement.Text   = m_legend.Title;
            pTitleElement.Symbol = plegendFormat.TitleSymbol;
            frmTextSymbol frmtext = new frmTextSymbol(ref pTitleElement);

            frmtext.ShowDialog();
            this.textBox1.Text        = pTitleElement.Text;
            plegendFormat.TitleSymbol = pTitleElement.Symbol;
        }
Пример #4
0
        public void AddText()
        {
            string m_text;

            m_text = "Text";
            IElement     m_elment      = new TextElement();
            ITextElement m_textElement = m_elment as ITextElement;

            // ITextSymbol m_textSymbol =new TextSymbolClass ();
            // m_textSymbol.Text= m_text;
            // m_textSymbol.Size = 48;
            m_textElement.Text = m_text;
            frmTextSymbol form1 = new frmTextSymbol(ref m_textElement);

            form1.ShowDialog();
            // m_textElement  = form1.getText();
            if (m_textElement.Text == "")
            {
                return;
            }
            IEnvelope m_envelope = new EnvelopeClass();

            m_envelope.PutCoords(13, 13, 17, 18);
            m_elment.Geometry = m_envelope;
            #region//直接调用AE添加文本对话框
            // ITextSymbolEditor m_textSymbolEditor=new TextSymbolEditorClass ();
            // m_Ok = m_textSymbolEditor.EditTextSymbol(ref  m_textSymbol, m_pagelayoutControl.hWnd);

            // if (m_Ok==true  )
            // {
            // m_textElement.Symbol = m_textSymbol;
            // m_textElement.Text = m_text;
            #endregion
            m_textElement.ScaleText = true;
            m_elment        = (IElement)m_textElement;
            m_elment.Locked = false;
            m_pagelayoutControl.AddElement(m_elment, Type.Missing, Type.Missing, "Text", 5);
            m_pagelayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
Пример #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     m_TitleElement = new TextElementClass();
     m_TitleElement.Text  = this.textBoxTitle.Text;
     frmTextSymbol frmtext = new frmTextSymbol(ref m_TitleElement);
     frmtext.ShowDialog();
     this.textBoxTitle.Text = m_TitleElement.Text;
 }
Пример #6
0
 private void btnTextSymbol_Click(object sender, EventArgs e)
 {
     ITextElement textElement = new TextElementClass();
     textElement.Symbol = pTextSymbol;
     textElement.Text = "图层名";
     frmTextSymbol frmText = new frmTextSymbol(ref textElement);
     frmText.ShowDialog();
     pTextSymbol = textElement.Symbol; //这里是设置标注的字体样式
 }
Пример #7
0
 private void btnSymbol_Click(object sender, EventArgs e)
 {
     //图例的大标题字体;
     m_legend.Title = this.textBox1.Text;
     plegendFormat = m_legend.Format;
     pTitleElement = new TextElementClass();
     pTitleElement.Text = m_legend.Title;
     pTitleElement.Symbol = plegendFormat.TitleSymbol;
     frmTextSymbol frmtext = new frmTextSymbol(ref pTitleElement);
     frmtext.ShowDialog();
     this.textBox1.Text = pTitleElement.Text;
     plegendFormat.TitleSymbol = pTitleElement.Symbol;
 }
Пример #8
0
        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);
                    }
                }
            }
        }
Пример #9
0
        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);
                    }
                }
            }
        }
Пример #10
0
        public void AddText()
        {
            string m_text;
            m_text = "Text";
            IElement m_elment = new TextElement();
            ITextElement m_textElement = m_elment as ITextElement;
               // ITextSymbol m_textSymbol =new TextSymbolClass ();
               // m_textSymbol.Text= m_text;
               // m_textSymbol.Size = 48;
             m_textElement.Text = m_text;
            frmTextSymbol form1 = new frmTextSymbol( ref m_textElement);
             form1.ShowDialog ();
             // m_textElement  = form1.getText();
            if (m_textElement .Text =="")
               return;
            IEnvelope m_envelope=new EnvelopeClass ();
            m_envelope.PutCoords(13, 13, 17, 18);
            m_elment.Geometry = m_envelope;
            #region//ֱ�ӵ���AE����ı��Ի���
            // ITextSymbolEditor m_textSymbolEditor=new TextSymbolEditorClass ();
               // m_Ok = m_textSymbolEditor.EditTextSymbol(ref  m_textSymbol, m_pagelayoutControl.hWnd);

               // if (m_Ok==true  )
               // {
               // m_textElement.Symbol = m_textSymbol;
            // m_textElement.Text = m_text;
            #endregion
            m_textElement.ScaleText = true;
                m_elment = (IElement)m_textElement;
                m_elment.Locked = false;
                m_pagelayoutControl.AddElement(m_elment, Type.Missing, Type.Missing, "Text", 5);
                m_pagelayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }