• 添加线标注ILineElement


     1 private void AddLineElement(IPolyline polyline)
     2         {
     3             try
     4             {
     5                 IPolyline pPolyline = polyline; 
     6                 IRgbColor pLineRgbColor = null;
     7                 ISimpleLineSymbol pSimpleLineSymbol = null;
     8                 ILineElement pFillShapeElement = null;
     9                 IElement pElement;
    10                 if (pPolyline != null)
    11                 {
    12                     pLineRgbColor = new RgbColorClass();
    13                     pLineRgbColor.Red = 255;
    14 
    15                     pSimpleLineSymbol = new SimpleLineSymbolClass();
    16                     pSimpleLineSymbol.Color = pLineRgbColor;
    17                     double with = 72 / this.axMapControl1.MapScale;
    18                     if (with >= 0.002)
    19                         with = 0.002;
    20                     pSimpleLineSymbol.Width = with;
    21 
    22 
    23                     pFillShapeElement = new LineElementClass();
    24                     pFillShapeElement.Symbol = pSimpleLineSymbol;
    25                     pElement = pFillShapeElement as IElement;
    26                     pPolyline.SpatialReference = this.axMapControl1.SpatialReference;
    27                     pElement.Geometry = pPolyline as IGeometry;
    28 
    29                     this.axMapControl1.ActiveView.GraphicsContainer.AddElement(pElement, 0);
    30                     this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElement, this.axMapControl1.ActiveView.Extent);
    31                    
    32                 }
    33                             }
    34             catch (Exception ee)
    35             {
    36                 System.Windows.Forms.MessageBox.Show(ee.Message, "添加线标注");
    37             }
    38         }
    View Code
  • 相关阅读:
    Java数组
    Java非访问修饰符
    Java 循环结构
    Java修饰符
    Java语句
    DDK
    HDC中的前景色与背景色
    如何控制一个程序只能有一个进程
    把一个bmp转换成cur显示出来(掩码mask)
    怎么设置IE代理服务器
  • 原文地址:https://www.cnblogs.com/fatherZyl/p/3323719.html
Copyright © 2020-2023  润新知