Beispiel #1
0
        private void InitTextElementStyle(ITextElement textElement)
        {
            txtContent.Text = textElement.Text;

            Font font    = new Font(textElement.Symbol.Font.Name, (float)textElement.Symbol.Font.Size);
            Font fontOld = font;

            if (textElement.Symbol.Font.Bold)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Bold);
            }
            if (textElement.Symbol.Font.Italic)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Italic);
            }
            if (textElement.Symbol.Font.Strikethrough)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Strikeout);
            }
            if (textElement.Symbol.Font.Underline)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Underline);
            }
            m_fontDialog.Font = font;
            lblExample.Font   = font;

            Color color = ColorTranslator.FromOle(textElement.Symbol.Color.RGB);

            m_fontDialog.Color   = color;
            lblExample.ForeColor = color;
        }
Beispiel #2
0
 public void UpdateTextElement(ITextElement textElement)
 {
     //修改
     m_textElement = textElement;
     m_Flag        = true;
     InitTextElementStyle(textElement);
 }
Beispiel #3
0
        private void axPageLayoutControl1_OnDoubleClick(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnDoubleClickEvent e)
        {
            if (e.button == 1)
            {
                //标注的修改
                if (axPageLayoutControl1.CurrentTool == null)
                {
                    return;
                }
                if (((axPageLayoutControl1.CurrentTool) as ICommand).Name == "ControlToolsGraphicElement_SelectTool")
                {
                    IPoint pPoint = new PointClass();
                    pPoint.PutCoords(e.pageX, e.pageY);


                    IGraphicsContainer pGraphicsContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer;

                    IEnumElement pEnumElement = pGraphicsContainer.LocateElements(pPoint, 10);
                    if (pEnumElement != null)
                    {
                        IElement pElement = pEnumElement.Next();
                        if (pElement is ITextElement)
                        {
                            ITextElement       ptextElement = pElement as ITextElement;
                            MapPrint.TextSetUp textSetUp    = new MapPrint.TextSetUp();
                            textSetUp.UpdateTextElement(ptextElement);
                            textSetUp.Show();
                        }
                    }
                }
            }
        }
        private void InitializeViewElements()
        {
            dialogManager = new DialogManager("NUnit Project Editor");
            messageDisplay = new MessageDisplay("NUnit Project Editor");

            browseProjectBaseCommand = new ButtonElement(projectBaseBrowseButton);
            editConfigsCommand = new ButtonElement(editConfigsButton);
            browseConfigBaseCommand = new ButtonElement(configBaseBrowseButton);
            addAssemblyCommand = new ButtonElement(addAssemblyButton);
            removeAssemblyCommand = new ButtonElement(removeAssemblyButton);
            browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            projectPath = new TextElement(projectPathLabel);
            projectBase = new TextElement(projectBaseTextBox);
            processModel = new ComboBoxElement(processModelComboBox);
            domainUsage = new ComboBoxElement(domainUsageComboBox);
            runtime = new ComboBoxElement(runtimeComboBox);
            runtimeVersion = new ComboBoxElement(runtimeVersionComboBox);
            activeConfigName = new TextElement(activeConfigLabel);

            configList = new ComboBoxElement(configComboBox);

            applicationBase = new TextElement(applicationBaseTextBox);
            configurationFile = new TextElement(configFileTextBox);
            binPathType = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            privateBinPath = new TextElement(privateBinPathTextBox);
            assemblyPath = new TextElement(assemblyPathTextBox);
            assemblyList = new ListBoxElement(assemblyListBox);
        }
Beispiel #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public XmlView()
        {
            InitializeComponent();

            xml = new TextElement(richTextBox1);
            messageDisplay = new MessageDisplay("NUnit Project Editor");
        }
Beispiel #6
0
 public SizeF MeasureOverride(
     SizeF availableSize,
     TextParams textParams,
     ITextElement element)
 {
     return(this.MeasureOverride(availableSize, textParams));
 }
Beispiel #7
0
 public override void Init()
 {
     for (int i = 0; i < this.RowNumber; i++)
     {
         for (int j = 0; j < this.ColumnNumber; j++)
         {
             string cellElement = this.GetCellElement(i, j);
             if ((cellElement.Length != 0) && (cellElement[0] == '='))
             {
                 ExpressionCalculator calculator = new ExpressionCalculator();
                 calculator.Init(cellElement.Substring(1));
                 for (int k = 0; k < calculator.ParamList.Count; k++)
                 {
                     string           str2  = calculator.ParamList.Keys[k];
                     MapTemplateParam param = base.MapTemplate.FindParamByName(str2);
                     if (param != null)
                     {
                         calculator.ParamList[str2] = param.Value;
                     }
                 }
                 object       obj2    = calculator.Calculate();
                 ITextElement element = (this.Element as ITableElement).GetCellElement(i, j) as ITextElement;
                 if (element != null)
                 {
                     element.Text = obj2.ToString();
                 }
             }
         }
     }
 }
Beispiel #8
0
        private IElement CreateJionTabTextElement(IActiveView pAV, string text, double x, double y,
                                                  IEnvelope pNewEnvelope)
        {
            ITextElement textElement = new TextElement() as ITextElement;

            ((ITextElement)textElement).Symbol = this.TextSymbol;
            textElement.Text = text;
            ITextElement textElementClass = textElement as ITextElement;
            IElement     element          = textElementClass as IElement;
            IPoint       pointClass       = new ESRI.ArcGIS.Geometry.Point();
            IEnvelope    envelopeClass    = new Envelope() as IEnvelope;

            pointClass.PutCoords(x, y);
            element.Geometry     = pointClass;
            this.TextSymbol.Text = text;
            IPolygon polygonClass = new Polygon() as IPolygon;

            element.QueryOutline(pAV.ScreenDisplay, polygonClass);
            element.QueryBounds(pAV.ScreenDisplay, envelopeClass);
            if (!envelopeClass.IsEmpty)
            {
                if (envelopeClass.Width > pNewEnvelope.Width)
                {
                    double width  = pNewEnvelope.Width / envelopeClass.Width;
                    double height = pNewEnvelope.Height / envelopeClass.Height;
                    (element as ITransform2D).Scale(pointClass, width, height);
                }
            }
            return(element);
        }
 public void UpdateTextElement(ITextElement textElement)
 {
     //修改
     m_textElement = textElement;
     m_Flag = true;
     InitTextElementStyle(textElement);
 }
Beispiel #10
0
        private void InitializeViewElements()
        {
            dialogManager  = new DialogManager("NUnit Project Editor");
            messageDisplay = new MessageDisplay("NUnit Project Editor");

            browseProjectBaseCommand  = new ButtonElement(projectBaseBrowseButton);
            editConfigsCommand        = new ButtonElement(editConfigsButton);
            browseConfigBaseCommand   = new ButtonElement(configBaseBrowseButton);
            addAssemblyCommand        = new ButtonElement(addAssemblyButton);
            removeAssemblyCommand     = new ButtonElement(removeAssemblyButton);
            browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            projectPath      = new TextElement(projectPathLabel);
            projectBase      = new TextElement(projectBaseTextBox);
            processModel     = new ComboBoxElement(processModelComboBox);
            domainUsage      = new ComboBoxElement(domainUsageComboBox);
            runtime          = new ComboBoxElement(runtimeComboBox);
            runtimeVersion   = new ComboBoxElement(runtimeVersionComboBox);
            activeConfigName = new TextElement(activeConfigLabel);

            configList = new ComboBoxElement(configComboBox);

            applicationBase   = new TextElement(applicationBaseTextBox);
            configurationFile = new TextElement(configFileTextBox);
            binPathType       = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            privateBinPath    = new TextElement(privateBinPathTextBox);
            assemblyPath      = new TextElement(assemblyPathTextBox);
            assemblyList      = new ListBoxElement(assemblyListBox);
        }
        /// <summary>
        /// 插入带文字的注记
        /// </summary>
        /// <param name="point"></param>
        /// <param name="mapControl"></param>
        /// <param name="text"></param>
        /// <returns></returns>

        public static IElement DrawSymbolWithText(IPoint point, AxMapControl mapControl, string text)
        {
            #region 设置样式
            IFontDisp pFont = new StdFont()
            {
                Name = "宋体",
                Size = 5
            } as IFontDisp;

            ITextSymbol pTextSymbol = new TextSymbolClass()
            {
                Color = GetColor(255, 0, 0),
                Font  = pFont,
                Size  = 11
            };
            #endregion
            //设置带注记的元素
            ITextElement pTextElment = null;
            pTextElment = new TextElementClass()
            {
                Symbol    = pTextSymbol,
                ScaleText = true,
                Text      = text
            };
            IElement pEle = pTextElment as IElement;
            pEle.Geometry = point;
            //添加标注
            InsertElement(mapControl, pEle, 1);
            return(pEle);
        }
Beispiel #12
0
        public void Add(ITextElement toAdd)
        {
            var backlog = new LinkedList <ITextElement>();
            var height  = 0f;

            backlog.AddFirst(toAdd);
            while (backlog.Any())
            {
                var element = backlog.PopFirst();
                if (element.Width > Width)
                {
                    if (element is ITextSplitable splitable)
                    {
                        var splitResult = splitable.Split(Width).ToList();
                        if (splitResult.First().Width <= 0)
                        {
                            continue;
                        }
                        foreach (var result in splitResult.Reverse <ITextElement>())
                        {
                            if (result.Width > 0)
                            {
                                backlog.AddFirst(result);
                            }
                        }
                    }
                }
                else
                {
                    Contents.Add(element);
                    height += element.Height;
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="lstvalue"></param>
        /// <param name="pageXPart">在X方向所在位置占整个page的比例比例</param>
        /// <param name="pageYPart">在Y方向所在位置占整个page的比例比例</param>
        /// <returns></returns>
        public bool AddText(List <string> lstvalue, double pageXPart, double pageYPart, string fountName, double fontSize)
        {
            pTextElement = new TextElementClass();
            string sValue = lstvalue[0];

            for (int i = 1; i < lstvalue.Count; i++)
            {
                sValue += "\n" + lstvalue[i];
            }
            pTextElement.Text = sValue;

            IElement    pElment = pTextElement as IElement;
            ITextSymbol pSymbol = new TextSymbolClass();

            pSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
            stdole.Font pFont;
            pFont               = new stdole.StdFontClass();
            pFont.Name          = fountName;
            pFont.Size          = (decimal)fontSize;
            pSymbol.Font        = pFont as stdole.IFontDisp;
            pTextElement.Symbol = pSymbol;
            IPoint    pPoint = new PointClass();
            IEnvelope pEnv   = new EnvelopeClass();

            pEnv = this.mainPage.ActiveView.Extent;

            pPoint.PutCoords((pEnv.XMin + pEnv.YMax) * pageXPart, (pEnv.YMin + pEnv.YMax) * pageYPart);

            addText(pTextElement, pPoint);
            return(true);
        }
        private void Init(ITextElement pTextElement)
        {
            this.SetColorEdit(this.colorEdit1, (pTextElement as ISymbolCollectionElement).Color);
            this.chkBold.Checked      = (pTextElement as ISymbolCollectionElement).Bold;
            this.chkItalic.Checked    = (pTextElement as ISymbolCollectionElement).Italic;
            this.chkUnderline.Checked = (pTextElement as ISymbolCollectionElement).Underline;
            switch ((pTextElement as ISymbolCollectionElement).HorizontalAlignment)
            {
            case esriTextHorizontalAlignment.esriTHALeft:
                this.rdoTHALeft.Checked = true;
                break;

            case esriTextHorizontalAlignment.esriTHACenter:
                this.rdoTHACenter.Checked = true;
                break;

            case esriTextHorizontalAlignment.esriTHARight:
                this.rdoTHARight.Checked = true;
                break;

            case esriTextHorizontalAlignment.esriTHAFull:
                this.rdoTHAFul.Checked = true;
                break;
            }
            this.cboFontName.Text   = (pTextElement as ISymbolCollectionElement).FontName;
            this.cboFontSize.Text   = (pTextElement as ISymbolCollectionElement).Size.ToString();
            this.symbolItem1.Symbol = this.m_pTextElement.Symbol;
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            IWorkspaceEdit workspace = null;

            for (int i = 0; i < this.m_pAnnoFeatureList.Count; i++)
            {
                IAnnotationFeature feature = this.m_pAnnoFeatureList[i] as IAnnotationFeature;
                try
                {
                    if (workspace == null)
                    {
                        IDataset dataset = (feature as IObject).Class as IDataset;
                        workspace = dataset.Workspace as IWorkspaceEdit;
                        workspace.StartEditOperation();
                    }
                    ITextElement annotation = feature.Annotation as ITextElement;
                    annotation.Symbol  = this.m_pTextElement.Symbol;
                    feature.Annotation = annotation as IElement;
                    (feature as IFeature).Store();
                }
                catch (Exception exception)
                {
                    Logger.Current.Error("", exception, "");
                }
            }
            if (workspace != null)
            {
                workspace.StopEditOperation();
            }
        }
 public void Add(ITextElement text)
 {
     if (TextsList.Count == 0 || TextsList.Last() != text)
     {
         TextsList.Add(text);
     }
 }
Beispiel #17
0
 public SizeF MeasureOverride(
     SizeF availableSize,
     TextParams textParams,
     ITextElement element)
 {
     throw new NotImplementedException();
 }
Beispiel #18
0
 public override void DrawTitle()
 {
     try
     {
         IPoint point = new PointClass();
         point.PutCoords((base.LeftUp.X + base.RightUp.X) / 2.0,
                         ((base.RightUp.Y + base.InOutDist) + this.double_2) + base.TitleDist);
         IElement item = new TextElementClass
         {
             Geometry = point
         };
         ITextElement element2 = item as ITextElement;
         element2.Text = base.MapTM;
         IElementProperties2 properties = element2 as IElementProperties2;
         ITextSymbol         symbol     = base.FontStyle(25.0, esriTextHorizontalAlignment.esriTHACenter,
                                                         esriTextVerticalAlignment.esriTVABottom);
         element2.Symbol = symbol;
         properties.Type = "图名";
         this.ilist_0.Add(item);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
Beispiel #19
0
        /// <summary>
        /// Constructor
        /// </summary>
        public XmlView()
        {
            InitializeComponent();

            xml            = new TextElement(richTextBox1);
            messageDisplay = new MessageDisplay("NUnit Project Editor");
        }
Beispiel #20
0
        /// <summary>
        ///     Add the SMARTMAP text as an ITextElement to the map layout. Place the text on top
        ///     off the black rectangle that was placed in the lower right hand corner between
        ///     the mapframe and the neatline.
        /// </summary>
        public override void addMedfordText()
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)ArcMap.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            try
            {
                ITextSymbol  pTextSym  = oSpatialSubs.createTextSymbol(255, 255, 255, (9 * base.YFactor), esriTextHorizontalAlignment.esriTHACenter, esriTextVerticalAlignment.esriTVACenter, "Arial");
                string       sText     = "CITY OF MEDFORD";
                ITextElement pTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC,
                                                                                 pTextSym,
                                                                                 ((base.XFactor * 1.19) * SPrintConst.MapFrame_XMax),
                                                                                 (base.XFactor * SPrintConst.MapFrame_XMax),
                                                                                 (base.YFactor * (SPrintConst.Neatline_YMax - SPrintConst.Logo_Offset)),
                                                                                 (base.YFactor * SPrintConst.Neatline_YMax),
                                                                                 sText);
                pTextSym  = null;
                pTextElem = null;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addMedfordText()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc = null;
                pGC    = null;
            }
        }
Beispiel #21
0
        /// <summary>
        /// Add the mapscale text to the Graphic Container. Places this text under the scale bar.
        /// </summary>
        /// <param name="sMapScale"></param>
        public override void addMapScaleText(string sMapScale)
        {
            CSpatialSubs       oSpatialSubs = new CSpatialSubs();
            IMxDocument        pMxDoc       = (IMxDocument)this.App.Document;
            IGraphicsContainer pGC          = (IGraphicsContainer)pMxDoc.PageLayout;

            IMapSurroundFrame pMSFrame  = null;
            IEnvelope         pEnv      = null;
            ITextSymbol       pTextSym  = null;
            ITextElement      pTextElem = null;

            try
            {
                //Locate the scalebar in the graphics container because we
                //want to put the mapscale right under it.
                //A scalebar is contained within a MapSurroundFrame.
                pGC.Reset();
                IElement pElem = pGC.Next();
                while (pElem != null)
                {
                    if (pElem is IMapSurroundFrame)
                    {
                        pMSFrame = (IMapSurroundFrame)pElem;
                        if (pMSFrame.Object is IScaleBar)
                        {
                            break;  // we got the scalebar
                        }
                    }
                    pElem = pGC.Next();
                }

                pEnv = new EnvelopeClass();
                //get the envelope of the scalebar
                pElem.QueryBounds(pMxDoc.ActiveView.ScreenDisplay, pEnv);

                double xMin = SPrintConst.MapscaleText_XMin * base.XFactor;
                double xMax = SPrintConst.MapscaleText_XMax * base.XFactor;
                double yMax = pEnv.YMin - 0.02;  //this is the min y value of the scalebar envelope - .02
                double yMin = SPrintConst.MapscaleText_YMin * base.YFactor;

                //Set pMapscaleText symbol to the textsymbol
                pTextSym  = oSpatialSubs.createTextSymbol(0, 0, 0, 7 * this.YFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial");
                pTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pTextSym, xMin, xMax, yMin, yMax, sMapScale);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Errors: CPortraitLayout:addMapScaleText()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                oSpatialSubs.Dispose();
                pMxDoc    = null;
                pGC       = null;
                pMSFrame  = null;
                pEnv      = null;
                pTextSym  = null;
                pTextElem = null;
            }
        }
Beispiel #22
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="textElementEditType"></param>
        /// <param name="textElement"></param>
        public FormTextElementEdit(IActiveView activeView, ITextElement textElement)
        {
            InitializeComponent();

            this.textElementEditType = TextElementEditType.Modify;
            this.activeView          = activeView;
            this.textElement         = textElement;
        }
Beispiel #23
0
 private void button1_Click(object sender, EventArgs e)
 {
     m_TextElement.Text = this.textBox1.Text.Trim();
     this.m_ActiveView.Refresh();
     this.Visible       = false;
     this.m_TextElement = null;
     this.Close();
 }
Beispiel #24
0
 public TextChange(IPageLayoutControlDefault pageLayout, ITextElement textElement)
 {
     InitializeComponent();
     pPageLayout        = pageLayout;
     pTextElement       = textElement;
     pTextSymbol        = pTextElement.Symbol;
     pGraphicsContainer = pageLayout.ActiveView.GraphicsContainer;
 }
Beispiel #25
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;
        }
 private void frmUpdateAnnoAttribute_Load(object sender, EventArgs e)
 {
     if (this.m_pAnnoFeatureList.Count > 0)
     {
         this.m_pTextElement = (this.m_pAnnoFeatureList[0] as IAnnotationFeature).Annotation as ITextElement;
         this.Init(this.m_pTextElement);
     }
     this.m_CanDo = true;
 }
Beispiel #27
0
        //更新时间
        public void updateTime()
        {
            //修改时间
            IElement     pElement     = axPageLayoutControl1.FindElementByName("Time");
            ITextElement pTextElement = pElement as ITextElement;

            pTextElement.Text = "制作时间:" + pTateTime.Year + "年" + pTateTime.Month + "月" + pTateTime.Day + "日" + pTateTime.Hour + "时" + pTateTime.Minute + "分";
            axPageLayoutControl1.Refresh();
        }
        public RenameConfigurationDialog()
        {
            InitializeComponent();

            configurationName = new TextElement(configurationNameTextBox);
            okButtonWrapper   = new ButtonElement(okButton);

            messageDisplay = new MessageDisplay("Rename Configuration");
        }
        protected void ProcessTextElement(DocxNode node)
        {
            ITextElement element = context.ConvertTextElement(node);

            if (element != null)
            {
                element.Process(node);
            }
        }
Beispiel #30
0
        //构造器
        public FrmAddText(ITextElement element, IHookHelper hookHelper)
        {
            InitializeComponent();

            pSrcTextElement = element;
            deepCopyFromTextElement(element);

            m_hookHelper = hookHelper;
        }
        public RenameConfigurationDialog()
		{
			InitializeComponent();

            configurationName = new TextElement(configurationNameTextBox);
            okButtonWrapper = new ButtonElement(okButton);

            messageDisplay = new MessageDisplay("Rename Configuration");
        }
Beispiel #32
0
        protected void ProcessTextElement(DocxNode node, Dictionary <string, object> properties)
        {
            ITextElement element = context.ConvertTextElement(node);

            if (element != null)
            {
                element.Process(node, properties);
            }
        }
Beispiel #33
0
        //生成线注记
        public ITextElement MakeTextElement(ITextElement pTextElement, IPolyline pPolyline, int intCharacterWidthIndexValue)
        {
            ITextElement pMyTextElement = new TextElementClass();

            pMyTextElement.Text = pTextElement.Text;

            ITextSymbol pTextSymbol = new TextSymbolClass();

            //若果要旋转注记
            if (!CommonFunction.MatchNumber(pMyTextElement.Text))//如果文字
            {
                if (m_IsRotationTextAnno)
                {
                    pTextSymbol.Angle = pTextElement.Symbol.Angle + Math.Atan(m_A1 / m_A2) * 180 / Math.PI - 90;
                }
                else
                {
                    pTextSymbol.Angle = pTextElement.Symbol.Angle;
                }
            }
            else//若果数字
            {
                if (m_IsRotationNumAnno)
                {
                    pTextSymbol.Angle = pTextElement.Symbol.Angle + Math.Atan(m_A1 / m_A2) * 180 / Math.PI - 90;
                }
                else
                {
                    pTextSymbol.Angle = pTextElement.Symbol.Angle;
                }
            }

            pTextSymbol.Color = pTextElement.Symbol.Color;
            pTextSymbol.Font  = pTextElement.Symbol.Font;
            pTextSymbol.HorizontalAlignment = pTextElement.Symbol.HorizontalAlignment;
            pTextSymbol.RightToLeft         = pTextElement.Symbol.RightToLeft;
            pTextSymbol.Size = pTextElement.Symbol.Size;
            pTextSymbol.Text = pTextElement.Symbol.Text;
            pTextSymbol.VerticalAlignment = pTextElement.Symbol.VerticalAlignment;

            IFormattedTextSymbol pFormattedTextSymbol = pTextSymbol as IFormattedTextSymbol;

            pFormattedTextSymbol.CharacterWidth = intCharacterWidthIndexValue;

            pMyTextElement.Symbol = pTextSymbol;

            IElement pElement;

            pElement = (IElement)pMyTextElement;

            pElement.Geometry = pPolyline;


            return(pMyTextElement);
        }
Beispiel #34
0
 public void Add(ITextElement element)
 {
     if (element is TextTableCell cell)
     {
         Contents.Add(cell);
     }
     else
     {
         throw new ArgumentException();
     }
 }
        public static void TextElementAdd(IPoint point, String content, System.Drawing.Font font, Color color, ref ITextElement textElementReturn)
        {
            ESRI.ArcGIS.Carto.ITextElement textElement = new TextElementClass();
            textElement.Text = content;

            ESRI.ArcGIS.Display.IRgbColor rgbColor = ColorToRgbColor(color);
            ITextSymbol textSymbol = SetUpTextSymbol(font, rgbColor);
            textElement.Symbol = textSymbol;
            IElement element = textElement as IElement;
            element.Geometry = point;

            IGraphicsContainer graphicsContainer = g_axPageLayoutControl.PageLayout as IGraphicsContainer;
            graphicsContainer.AddElement(element, 0);
            g_axPageLayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            textElementReturn = textElement;
        }
Beispiel #36
0
        public void ShowCoordinatesOnMap(AxGlobeControl axGlobeControl)
        {
            try
            {
                ITextSymbol pTextSymbol = new TextSymbolClass();
                //pTextSymbol.Font = new Font("Consolas", 10, FontStyle.Regular);    //设置字体
                pTextSymbol.Size = 12;          //字体大小
                pTextSymbol.Color = BaseGISTools.TransColorToAEColor(Color.White);    //字体颜色

                myTextElement = new TextElementClass(); ;
                myTextElement.Symbol = pTextSymbol; //设置样式
                myTextElement.Text = "这是现实的信息 \n 这是第二行 \n 这是第三行";

                graphicsLayer = axGlobeControl.GlobeDisplay.Scene.BasicGraphicsLayer;
                graphicsContain3D = (IGraphicsContainer3D)graphicsLayer;
                graphicsContain3D.AddElement(myTextElement as IElement);
                axGlobeControl.GlobeDisplay.RefreshViewers();
            }
            catch { }
        }
 /// <summary>
 /// Insert a <see cref="TextElement"/> at the specified location
 /// </summary>
 /// <param name="index">The index</param>
 /// <param name="textElement">The <see cref="TextElement"/></param>
 public void Insert(int index,ITextElement textElement)
 {
     if (textElement != null) {
         List.Insert(index,textElement) ;
         // listen to its PropertyChange events
         textElement.PropertyChange += new TextElementPropertyChangeEventHandler(TextElementCollection_PropertyChange);
         // notify our listeners we changed
         OnChangeEvent() ;
     }
 }
 /// <summary>
 /// Get the index of the specified <see cref="TextElement"/>
 /// </summary>
 /// <param name="textElement">The <c>TextElement</c> to find</param>
 /// <returns>
 /// The index of the <see cref="TextElement"/> within the <c>TextElementCollection</c>
 /// or -1 if it is not a member
 /// </returns>
 public int IndexOf(ITextElement textElement)
 {
     return InnerList.IndexOf(textElement) ;
 }
 /// <summary>
 /// Get the index of the specified <see cref="TextElement"/>
 /// </summary>
 /// <param name="textElement">The <c>TextElement</c> to find</param>
 /// <returns>
 /// <see langword="true"/> if the <see cref="TextElement"/> is a member
 /// of the <c>TextElementCollection</c>
 /// </returns>
 public bool Contains(ITextElement textElement)
 {
     return InnerList.Contains(textElement) ;
 }
        /// <summary>
        /// Add 'N' <see cref="TextElement"/> items to the collection
        /// </summary>
        /// <param name="textElements">The <see cref="TextElement"/>'s to be added</param>
        public void AddRange(ITextElement [] textElements)
        {
            foreach(ITextElement textElement in textElements) {
                if (textElement != null) {
                    textElement.PropertyChange += new TextElementPropertyChangeEventHandler(TextElementCollection_PropertyChange);
                    base.InnerList.Add(textElement) ;
                }
            }

            OnChangeEvent() ;
        }
        /// <summary>
        /// Add a <see cref="TextElement"/> to the collection
        /// </summary>
        /// <param name="textElement">The <see cref="TextElement"/></param>
        /// <returns>
        /// The index of the inserted item
        /// </returns>
        public int Add(ITextElement textElement)
        {
            if (textElement == null)
                return -1 ;

            int result = base.InnerList.Add(textElement) ;

            if (result != -1) {
                // listen to its PropertyChange events
                textElement.PropertyChange += new TextElementPropertyChangeEventHandler(TextElementCollection_PropertyChange);
                // notify our listeners we changed
                OnChangeEvent() ;
            }

            return result ;
        }
 /// <summary>
 /// Get the <see cref="System.Drawing.Color"/> used by a <see cref="TextElement"/>
 /// </summary>
 /// <param name="textElement">The TextElement being drawn/measured</param>
 /// <returns>
 /// The <see cref="TextElement.Font"/> value, or if <see langword="null"/> the
 /// <see cref="Font"/> of this <c>TextLayoutPanel</c>
 /// </returns>
 private Color GetElementTextColor(ITextElement textElement)
 {
     return (textElement.TextColor != Color.Empty) ? textElement.TextColor : ForeColor ;
 }
 /// <summary>
 /// Get the <see cref="System.Drawing.Font"/> used by a <see cref="TextElement"/>
 /// </summary>
 /// <param name="textElement">The TextElement being drawn/measured</param>
 /// <returns>
 /// The <see cref="TextElement.Font"/> value, or if <see langword="null"/> the
 /// <see cref="Font"/> of this <c>TextLayoutPanel</c>
 /// </returns>
 private Font GetElementFont(ITextElement textElement)
 {
     return (textElement.Font != null) ? textElement.Font : Font ;
 }
Beispiel #44
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;
 }
Beispiel #45
0
 public frmTextSymbol( ref ITextElement textElement)
 {
     InitializeComponent();
     pTextElement = textElement;
 }
Beispiel #46
0
        private void InitTextElementStyle(ITextElement textElement)
        {
            txtContent.Text = textElement.Text;

            Font font = new Font(textElement.Symbol.Font.Name, (float)textElement.Symbol.Font.Size);
            Font fontOld = font;
            if (textElement.Symbol.Font.Bold)
            {
                fontOld = font;
                font = new Font(fontOld, FontStyle.Bold);
            }
            if (textElement.Symbol.Font.Italic)
            {
                fontOld = font;
                font = new Font(fontOld, FontStyle.Italic);
            }
            if (textElement.Symbol.Font.Strikethrough)
            {
                fontOld = font;
                font = new Font(fontOld, FontStyle.Strikeout);
            }
            if (textElement.Symbol.Font.Underline)
            {
                fontOld = font;
                font = new Font(fontOld, FontStyle.Underline);
            }
            m_fontDialog.Font = font;
            lblExample.Font = font;

            Color color = ColorTranslator.FromOle(textElement.Symbol.Color.RGB);
            m_fontDialog.Color = color;
            lblExample.ForeColor = color;
        }
        private bool addText(ITextElement ppTextElement, IGeometry geo)
        {
            IPageLayout pPageLayout = mainPage.PageLayout;
            IGraphicsContainer pGraphicsContainer = mainPage.PageLayout as IGraphicsContainer;
            IEnvelope pEnv = new EnvelopeClass();
            IElement pElement = ppTextElement as IElement;

            pEnv = this.mainPage.ActiveView.Extent;

            if (geo == null)
            {
                IPoint pPoint = new PointClass();
                pPoint.PutCoords((pEnv.XMin + pEnv.YMax) / 2, (pEnv.YMin + pEnv.YMax) / 2);
                pElement.Geometry = pPoint;
            }
            else
            {
                pElement.Geometry = geo;
            }

            pGraphicsContainer.AddElement(pElement, 0);
            mainPage.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            return true;
        }
 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;
 }
        internal static void TextElementUpdate(ITextElement textElement, String content, System.Drawing.Font font, Color color)
        {
            //ESRI.ArcGIS.Carto.ITextElement textElement = new TextElementClass();
            textElement.Text = content;

            ESRI.ArcGIS.Display.IRgbColor rgbColor = ColorToRgbColor(color);
            ITextSymbol textSymbol = SetUpTextSymbol(font, rgbColor);
            textElement.Symbol = textSymbol;
            IElement element = textElement as IElement;
            //element.Geometry = point;

            IGraphicsContainer graphicsContainer = g_axPageLayoutControl.PageLayout as IGraphicsContainer;
            graphicsContainer.UpdateElement(element);
            g_axPageLayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
        //添加文本
        public bool AddText()
        {
            pTextElement = new TextElementClass();
            pTextElement.Text = "输入文本";

            IElement pElment = pTextElement as IElement;
            ITextSymbol pSymbol = new TextSymbolClass();
            pSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
            stdole.Font pFont;
            pFont = new stdole.StdFontClass();
            pFont.Name = "verdana";
            pFont.Size = 40;
            pSymbol.Font = pFont as stdole.IFontDisp;
            pTextElement.Symbol = pSymbol;
            addText(pTextElement, null);
            return true;
        }