// ArcGIS Snippet Title: // Create Simple Marker Symbol // // Long Description: // Create a simple marker symbol by specifying and input color and marker style. // // Add the following references to the project: // ESRI.ArcGIS.Display // ESRI.ArcGIS.System // // Intended ArcGIS Products for this snippet: // ArcGIS Desktop (Standard, Advanced, Basic) // ArcGIS Engine // ArcGIS Server // // Applicable ArcGIS Product Versions: // 9.2 // 9.3 // 9.3.1 // 10.0 // // Required ArcGIS Extensions: // (NONE) // // Notes: // This snippet is intended to be inserted at the base level of a Class. // It is not intended to be nested within an existing Method. // ///<summary>Create a simple marker symbol by specifying and input color and marker style.</summary> /// ///<param name="rgbColor">An IRGBColor interface.</param> ///<param name="inputStyle">An esriSimpleMarkerStyle enumeration. Example: esriSMSCircle.</param> /// ///<returns>An ISimpleMarkerSymbol interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Display.ISimpleMarkerSymbol CreateSimpleMarkerSymbol(ESRI.ArcGIS.Display.IRgbColor rgbColor, ESRI.ArcGIS.Display.esriSimpleMarkerStyle inputStyle) { ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass(); simpleMarkerSymbol.Color = rgbColor; simpleMarkerSymbol.Style = inputStyle; return(simpleMarkerSymbol); }
private void FormOptions_Load(object sender, EventArgs e) { //在窗体加载时获取当前选择环境设置的默认颜色和默认容限值 //首先获取当前选择环境对象的默认颜色 ESRI.ArcGIS.Display.IColor esriColor = currentSelectionEnvironment.DefaultColor; //对IColor接口的对象进行接口转换,以便使用RGB颜色值 ESRI.ArcGIS.Display.IRgbColor rgbColor = esriColor as ESRI.ArcGIS.Display.IRgbColor; //根据获取的RGB值,创建Windows颜色对象 System.Drawing.Color color = System.Drawing.Color.FromArgb(rgbColor.Red, rgbColor.Green, rgbColor.Green); //将创建的Windows颜色对象应用于pictureBoxColor控件的背景颜色中 pictureBoxColor.BackColor = color; //获取并显示当前选择环境的默认容限值 textBoxTolerance.Text = currentSelectionEnvironment.SearchTolerance.ToString(); }
// ArcGIS Snippet Title: // Create Simple Line Symbol // // Long Description: // Create a simple line symbol by specifying a color, width and line style. // // Add the following references to the project: // ESRI.ArcGIS.Display // ESRI.ArcGIS.System // // Intended ArcGIS Products for this snippet: // ArcGIS Desktop (Standard, Advanced, Basic) // ArcGIS Engine // ArcGIS Server // // Applicable ArcGIS Product Versions: // 9.2 // 9.3 // 9.3.1 // 10.0 // // Required ArcGIS Extensions: // (NONE) // // Notes: // This snippet is intended to be inserted at the base level of a Class. // It is not intended to be nested within an existing Method. // ///<summary>Create a simple line symbol by specifying a color, width and line style.</summary> /// ///<param name="rgbColor">An IRGBColor interface.</param> ///<param name="inWidth">A System.Double that is the width of the line symbol in points. Example: 2</param> ///<param name="inStyle">An esriSimpleLineStyle enumeration. Example: esriSLSSolid.</param> /// ///<returns>An ISimpleLineSymbol interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Display.ISimpleLineSymbol CreateSimpleLineSymbol(ESRI.ArcGIS.Display.IRgbColor rgbColor, System.Double inWidth, ESRI.ArcGIS.Display.esriSimpleLineStyle inStyle) { if (rgbColor == null) { return(null); } ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Style = inStyle; simpleLineSymbol.Color = rgbColor; simpleLineSymbol.Width = inWidth; return(simpleLineSymbol); }
// ArcGIS Snippet Title: // Create Simple Fill Symbol // // Long Description: // Create a simple fill symbol by specifying a color, outline color and fill style. // // Add the following references to the project: // ESRI.ArcGIS.Display // ESRI.ArcGIS.System // // Intended ArcGIS Products for this snippet: // ArcGIS Desktop (Standard, Advanced, Basic) // ArcGIS Engine // ArcGIS Server // // Applicable ArcGIS Product Versions: // 9.2 // 9.3 // 9.3.1 // 10.0 // // Required ArcGIS Extensions: // (NONE) // // Notes: // This snippet is intended to be inserted at the base level of a Class. // It is not intended to be nested within an existing Method. // ///<summary>Create a simple fill symbol by specifying a color, outline color and fill style.</summary> /// ///<param name="fillColor">An IRGBColor interface. The color for the inside of the fill symbol.</param> ///<param name="fillStyle">An esriSimpleLineStyle enumeration for the inside fill symbol. Example: esriSFSSolid.</param> ///<param name="borderColor">An IRGBColor interface. The color for the outside line border of the fill symbol.</param> ///<param name="borderStyle">An esriSimpleLineStyle enumeration for the outside line border. Example: esriSLSSolid.</param> ///<param name="borderWidth">A System.Double that is the width of the outside line border in points. Example: 2</param> /// ///<returns>An ISimpleFillSymbol interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Display.ISimpleFillSymbol CreateSimpleFillSymbol(ESRI.ArcGIS.Display.IRgbColor fillColor, ESRI.ArcGIS.Display.esriSimpleFillStyle fillStyle, ESRI.ArcGIS.Display.IRgbColor borderColor, ESRI.ArcGIS.Display.esriSimpleLineStyle borderStyle, System.Double borderWidth) { ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Width = borderWidth; simpleLineSymbol.Color = borderColor; simpleLineSymbol.Style = borderStyle; ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass(); simpleFillSymbol.Outline = simpleLineSymbol; simpleFillSymbol.Style = fillStyle; simpleFillSymbol.Color = fillColor; return(simpleFillSymbol); }
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 static IRgbColor CreatRgbColor(int nR, int nG, int nB, bool blTransparency) { ESRI.ArcGIS.Display.IRgbColor pRgbColor = null; pRgbColor = new ESRI.ArcGIS.Display.RgbColor(); if (blTransparency == true) { pRgbColor.Transparency = 0; } else { pRgbColor.Red = nR; pRgbColor.Green = nG; pRgbColor.Blue = nB; } return(pRgbColor); }
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; }
private ESRI.ArcGIS.Display.IRgbColor esriColor; //设置类变量来存储当前设置的颜色值 public FormOptions() { InitializeComponent(); //初始化esriColor对象 esriColor = new ESRI.ArcGIS.Display.RgbColorClass(); }
///<summary>Flash geometry on the display. The geometry type could be polygon, polyline, point, or multipoint.</summary> /// ///<param name="geometry"> An IGeometry interface</param> ///<param name="color">An IRgbColor interface</param> ///<param name="display">An IDisplay interface</param> ///<param name="delay">A System.Int32 that is the time im milliseconds to wait.</param> /// ///<remarks></remarks> public static void FlashGeometry(ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor color, ESRI.ArcGIS.Display.IDisplay display, System.Int32 delay, IEnvelope envelope) { if (geometry == null || color == null || display == null) { return; } display.StartDrawing(display.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast switch (geometry.GeometryType) { case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon: { //Set the flash geometry's symbol. ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass(); simpleFillSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen; //Flash the input polygon geometry. display.SetSymbol(symbol); display.DrawPolygon(geometry); System.Threading.Thread.Sleep(delay); display.DrawPolygon(geometry); break; } case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline: { //Set the flash geometry's symbol. ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Width = 4; simpleLineSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol symbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen; //Flash the input polyline geometry. display.SetSymbol(symbol); display.DrawPolyline(geometry); System.Threading.Thread.Sleep(delay); display.DrawPolyline(geometry); break; } case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint: { //Set the flash geometry's symbol. ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass(); simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle; simpleMarkerSymbol.Size = 12; simpleMarkerSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol markerSymbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast markerSymbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen; ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Width = 1; simpleLineSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol lineSymbol = simpleLineSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast lineSymbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen; //Flash the input polygon geometry. display.SetSymbol(markerSymbol); display.SetSymbol(lineSymbol); ArcMapHelpers.DrawCrossHair(geometry, display, envelope, markerSymbol, lineSymbol); //Flash the input point geometry. display.SetSymbol(markerSymbol); display.DrawPoint(geometry); System.Threading.Thread.Sleep(delay); display.DrawPoint(geometry); break; } case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint: { //Set the flash geometry's symbol. ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass(); simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle; simpleMarkerSymbol.Size = 12; simpleMarkerSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol symbol = simpleMarkerSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast symbol.ROP2 = ESRI.ArcGIS.Display.esriRasterOpCode.esriROPNotXOrPen; //Flash the input multipoint geometry. display.SetSymbol(symbol); display.DrawMultipoint(geometry); System.Threading.Thread.Sleep(delay); display.DrawMultipoint(geometry); break; } } display.FinishDrawing(); }
public static IRasterRenderer CreateDoDClassifyRenderer(Raster gRaster, int iClassCount, double rampRange) { try { // Open file raster dataset and ensure that statistics and histograms are present (absence of histograms will cause Renderer.Update() to crash) IRasterDataset rasterDataset = ArcMapUtilities.GetRasterDataset(gRaster); ESRI.ArcGIS.DataSourcesRaster.IRasterBandCollection pRastBands = (ESRI.ArcGIS.DataSourcesRaster.IRasterBandCollection)rasterDataset; ESRI.ArcGIS.DataSourcesRaster.IEnumRasterBand enumRasterBand = (ESRI.ArcGIS.DataSourcesRaster.IEnumRasterBand)pRastBands.Bands; rasterDataset.PrecalculateStats(0); ESRI.ArcGIS.DataSourcesRaster.IRasterBand pRastBand = enumRasterBand.Next(); pRastBand.ComputeStatsAndHist(); IRasterClassifyColorRampRenderer classifyRenderer = new RasterClassifyColorRampRendererClass(); IRasterRenderer rasterRenderer = (IRasterRenderer)classifyRenderer; IFillSymbol fillSymbol = new SimpleFillSymbolClass(); IRaster raster = rasterDataset.CreateDefaultRaster(); double rMin = -2.5; double rMax = 2.5; if (rampRange == 0) { gRaster.ComputeStatistics(); Dictionary <string, decimal> rasterStats = gRaster.GetStatistics(); rMin = (double)rasterStats["min"]; rMax = (double)rasterStats["max"]; } else { rMin = rampRange * -1; rMax = rampRange; } rasterRenderer.Raster = raster; if ((rMin == double.MinValue & rMax == double.MaxValue) | (rMin == double.MaxValue & rMax == double.MinValue) | (rMin == float.MinValue & rMax == float.MaxValue) | (rMin == float.MaxValue & rMax == float.MinValue)) { classifyRenderer.ClassCount = 1; ESRI.ArcGIS.Display.IRgbColor rgbColor = CreateRGBColor(255, 255, 255); rgbColor.Transparency = 0; fillSymbol.Color = rgbColor; classifyRenderer.Symbol[0] = (ISymbol)fillSymbol; classifyRenderer.Label[0] = "No Data (no change detected)"; return(rasterRenderer); } classifyRenderer.ClassCount = iClassCount; rasterRenderer.Update(); CreateDoDClassBreaks(rMax, rMin, iClassCount, ref classifyRenderer); List <IColor> lColors = CreateDoDColorRamp(); for (int i = 0; i < classifyRenderer.ClassCount; i++) { fillSymbol.Color = lColors[i]; classifyRenderer.Symbol[i] = (ISymbol)fillSymbol; } return(rasterRenderer); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }
public void AddGraphicToMap(ESRI.ArcGIS.Carto.IMap map, ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor rgbColor, ESRI.ArcGIS.Display.IRgbColor outlineRgbColor) { ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)map; // Explicit Cast ESRI.ArcGIS.Carto.IElement element = null; if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { // Marker symbols ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbol(); simpleMarkerSymbol.Color = rgbColor; simpleMarkerSymbol.Outline = true; simpleMarkerSymbol.OutlineColor = outlineRgbColor; simpleMarkerSymbol.Size = frmOptions.sizeOfPoints; simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle; ESRI.ArcGIS.Carto.IMarkerElement markerElement = (IMarkerElement) new ESRI.ArcGIS.Carto.MarkerElement(); markerElement.Symbol = simpleMarkerSymbol; element = (ESRI.ArcGIS.Carto.IElement)markerElement; // Explicit Cast } else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) { // Line elements ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbol(); simpleLineSymbol.Color = rgbColor; simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid; simpleLineSymbol.Width = frmOptions.sizeOfLines; ESRI.ArcGIS.Carto.ILineElement lineElement = (ILineElement) new ESRI.ArcGIS.Carto.LineElement(); lineElement.Symbol = simpleLineSymbol; element = (ESRI.ArcGIS.Carto.IElement)lineElement; // Explicit Cast } else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) { // Polygon elements ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbol(); simpleFillSymbol.Color = rgbColor; simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal; ESRI.ArcGIS.Carto.IFillShapeElement fillShapeElement = (IFillShapeElement) new ESRI.ArcGIS.Carto.PolygonElement(); fillShapeElement.Symbol = simpleFillSymbol; element = (ESRI.ArcGIS.Carto.IElement)fillShapeElement; // Explicit Cast } if (!(element == null)) { element.Geometry = geometry; graphicsContainer.AddElement(element, 0); } }
///<summary>在地图上绘制指定颜色的图形</summary> ///<param name="scene">地图</param> ///<param name="geometry">feature 的shape</param> ///<param name="rgbColor">颜色</param> ///<param name="outlineRgbColor">边框颜色</param> ///<param name="OffsetZs">Z偏值</param> /// ///<remarks>Calling this function will not automatically make the graphics appear in the map area. Refresh the map area after after calling this function with Methods like IActiveView.Refresh or IActiveView.PartialRefresh.</remarks> internal static IElement AddGraphicToScene(IScene scene, ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor rgbColor, ESRI.ArcGIS.Display.IRgbColor outlineRgbColor, double OffsetZs) { //ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)map; //IGraphicsContainer接口能删除 IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)scene.BasicGraphicsLayer; ESRI.ArcGIS.Carto.IElement element = null; if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { IPoint point = (Point)geometry; try { double X = point.X; double Y = point.Y; } catch { return(null); } point = GeometryUtilities.ConstructPoint3D(point, OffsetZs); // Marker symbols ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass(); simpleMarkerSymbol.Color = rgbColor; simpleMarkerSymbol.Outline = true; simpleMarkerSymbol.OutlineColor = rgbColor; simpleMarkerSymbol.Size = 12; simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle; ESRI.ArcGIS.Carto.IMarkerElement markerElement = new ESRI.ArcGIS.Carto.MarkerElementClass(); markerElement.Symbol = simpleMarkerSymbol; element = (ESRI.ArcGIS.Carto.IElement)markerElement; // Explicit Cast if (!(element == null)) { element.Geometry = point; graphicsContainer3D.AddElement(element); } } else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) { // Marker symbols ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Color = rgbColor; simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid; simpleLineSymbol.Width = 1; ESRI.ArcGIS.Carto.ILineElement lineElement = new ESRI.ArcGIS.Carto.LineElementClass(); lineElement.Symbol = simpleLineSymbol; element = (ESRI.ArcGIS.Carto.IElement)lineElement; // Explicit Cast if (!(element == null)) { element.Geometry = geometry; graphicsContainer3D.AddElement(element); } } else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) { IZ iz = (IZ)geometry; iz.OffsetZs(OffsetZs);//z值向上偏移 // Polygon elements ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass(); simpleFillSymbol.Color = rgbColor; simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal; ESRI.ArcGIS.Carto.IFillShapeElement fillShapeElement = new ESRI.ArcGIS.Carto.PolygonElementClass(); fillShapeElement.Symbol = simpleFillSymbol; element = (ESRI.ArcGIS.Carto.IElement)fillShapeElement; // Explicit Cast if (!(element == null)) { element.Geometry = geometry; graphicsContainer3D.AddElement(element); } } return(element); }
/// <summary> /// 在地图上绘制指定颜色的文字 /// </summary> /// <param name="scene"></param> /// <param name="geometry"></param> /// <param name="OffsetZs"></param> /// <param name="rgbColor"></param> /// <param name="text"></param> /// <param name="fontSize"></param> /// <returns></returns> internal static IElement AddTextGraphicToScene(IScene scene, ESRI.ArcGIS.Geometry.IGeometry geometry, double OffsetZs, ESRI.ArcGIS.Display.IRgbColor rgbColor, string text, int fontSize) { IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)scene.BasicGraphicsLayer; IText3DElement pTextElement = new Text3DElementClass(); IFillShapeElement pFillShapeElement = new Text3DElementClass(); pTextElement.Text = text; IFillSymbol pFillSymbol = new SimpleFillSymbol(); pFillSymbol.Color = rgbColor;//填充的颜色 IPoint point; try { IArea3D Area3D = (IArea3D)geometry; point = Area3D.Centroid3D; } catch { point = (IPoint)geometry; GeometryUtilities.MakeZAware(point); } point.Z = point.Z + OffsetZs; pTextElement.AnchorPoint = point; //添加文本的坐标点 pTextElement.Justification = esriT3DJustification.esriT3DJustifyCenter; //注记排放方式 pTextElement.OrientationPlane = esriT3DOrientationPlane.esriT3DPlaneXY; //注记的旋转平面 pTextElement.AxisRotation = esriT3DRotationAxis.esriT3DRotateAxisZ; //注记旋转轴 //pTextElement.RotationAngle=....;//注记的旋转角度 pTextElement.ZAxisScale = 1; pTextElement.Depth = 0.6; //文本的深度 pTextElement.Height = fontSize; //文本的高度,即文字大小 pTextElement.Update(); pFillShapeElement = (IFillShapeElement)pTextElement; pFillShapeElement.Symbol = pFillSymbol; graphicsContainer3D.AddElement(pTextElement as IElement); return(pTextElement as IElement); }