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

  • 相关阅读:
    【WPF】ListBox GridViewColumn Header 文字换行、文字多行显示
    【Unity】讯飞语音识别SDK
    【Unity】UGUI无法修改UI元素的Pivot锚点位置
    【Unity】EasyTouch5触屏检测
    【Unity】序列化字典Dictionary的问题
    【WPF】自定义形状的按钮Button
    【WPF】图片按钮的单击与双击事件
    【Unity】ShareSDK、SMSSDK的基本使用与常见问题
    【Unity】不能新建项目
    【Java】移动JDK路径后,修改环境变量不生效 Error: could not open `C:Program FilesJavajre1.8.0_131libamd64jvm.cfg'
  • 原文地址:https://www.cnblogs.com/gisoracle/p/1701965.html
Copyright © 2011-2022 走看看