private void axPageLayoutControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnMouseDownEvent e)
        {
            //Check if the right button of the mouse was clicked
            if (e.button != 2)
            {
                return;
            }
            //Ensure a text symbol has been selected
            if (m_textSymbol == null)
            {
                return;
            }

            //Create a point and set its coordinates
            IPoint point = new PointClass();

            point.X = e.pageX;
            point.Y = e.pageY;

            //Create a text element
            ITextElement textElement = new TextElementClass();

            textElement.Text = textBox1.Text;

            //Set the size of the text
            if (comboBox1.SelectedItem.ToString() == ("8pt"))
            {
                m_textSymbol.Size = 8.0;
            }
            else if (comboBox1.SelectedItem.ToString() == ("10pt"))
            {
                m_textSymbol.Size = 10.0;
            }
            else if (comboBox1.SelectedItem.ToString() == ("12pt"))
            {
                m_textSymbol.Size = 12.0;
            }
            else if (comboBox1.SelectedItem.ToString() == ("14pt"))
            {
                m_textSymbol.Size = 14.0;
            }

            //Set the TextElement symbol to that of the selected text symbol
            textElement.Symbol    = m_textSymbol;
            textElement.ScaleText = true;

            //QI to IElment
            IElement element = (IElement)textElement;

            //Set the TextElement's geometry
            element.Geometry = point;

            //Add the element to the GraphicsContainer
            axPageLayoutControl1.ActiveView.GraphicsContainer.AddElement(element, 0);
            //Refresh the PageLayout
            axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, null);
        }
 private void axPageLayoutControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnMouseDownEvent e)
 {
     if (e.button == 1)
     {
         axPageLayoutControl1.Extent = axPageLayoutControl1.TrackRectangle();
     }
     else if (e.button == 2)
     {
         axPageLayoutControl1.Pan();
     }
 }
Exemple #3
0
        private void axPageLayoutControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnMouseDownEvent e)
        {
            if (e.button != 2)
            {
                return;
            }

            //Create a new point
            IPoint pPoint = new PointClass();

            pPoint.PutCoords(e.pageX, e.pageY);

            //Create a new text element
            ITextElement textElement = new TextElementClass();

            //Set the text to display today's date
            textElement.Text = DateTime.Now.ToShortDateString();

            //Add element to graphics container using the CommandsEnvironment default text symbol
            axPageLayoutControl1.AddElement((IElement)textElement, pPoint, m_graphicProperties.TextSymbol, "", 0);
            //Refresh the graphics
            axPageLayoutControl1.Refresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
Exemple #4
0
 private void axPageLayoutControl1_OnMouseDown(object sender,
                                               ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnMouseDownEvent e)
 {
 }