zoukankan      html  css  js  c++  java
  • arcengine C# 布局插入文本

     using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using ESRI.ArcGIS.Controls;
    using ESRI.ArcGIS.Geometry;
    using ESRI.ArcGIS.Analyst3D;
    using ESRI.ArcGIS.Carto;
    using ESRI.ArcGIS.Display;
    using ESRI.ArcGIS.esriSystem;
    using ESRI.ArcGIS.Geodatabase;
    using ESRI.ArcGIS.GeoAnalyst;
    using stdole;

    public void AddTextElement(AxPageLayoutControl PageLayoutControl, double x, double y, string textName)
            {
                IPageLayout pPageLayout;
                IActiveView pAV;
                IGraphicsContainer pGraphicsContainer;
                IPoint pPoint;
                ITextElement pTextElement;
                IElement pElement;
                ITextSymbol pTextSymbol;
                IRgbColor pColor;
                pPageLayout = PageLayoutControl.PageLayout;
                pAV = (IActiveView)pPageLayout;
                pGraphicsContainer = (IGraphicsContainer)pPageLayout;
                pTextElement = new TextElementClass();

                IFontDisp pFont = new StdFontClass() as IFontDisp;
                pFont.Bold = true;
                pFont.Name = "宋体";
                pFont.Size = 20;

                pColor = new RgbColorClass();
                pColor.Red = 255;

                pTextSymbol = new TextSymbolClass();
                pTextSymbol.Color = (IColor)pColor;
                pTextSymbol.Font = pFont;

                pTextElement.Text = textName;
                pTextElement.Symbol = pTextSymbol;

                pPoint = new PointClass();
                pPoint.X = x;
                pPoint.Y = y;

                pElement = (IElement)pTextElement;
                pElement.Geometry = (IGeometry)pPoint;
                pGraphicsContainer.AddElement(pElement, 0);

                pAV.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            }

            private void button2_Click_1(object sender, EventArgs e)
            {
                AddTextElement(this.axPageLayoutControl1, 10, 10, "gisoracle欢迎你 Email:gisoracle@126.com,或QQ:276529800联系");
            }
    参考:http://www.gisbase.cn/chxnews.asp?id=1019

  • 相关阅读:
    python:利用asyncio进行快速抓取
    os.path.exists(path) 和 os.path.lexists(path) 的区别
    isdigit()判断是不是数字
    switf资源
    51cto培训课程
    51cto运维培训课程
    Python: 在Unicode和普通字符串之间转换
    VC++ CopyFile函数使用方法
    Eclipse断点调试
    AFNetworking2.0后 进行Post请求
  • 原文地址:https://www.cnblogs.com/gisoracle/p/1701965.html
Copyright © 2011-2022 走看看