I'm looking to do the following. Create a point on a map at a given coordinate (x,y) and then display text at that point. Right now I can create a shape file but nothing is displayed on the map. Hopefully someone can tell me why
Here is my code:
ArcDisplay.IRgbColor color = new RgbColorClass(){ Red = 255, Green = 255, Blue = 255};IPoint point = new PointClass(){ X = 0.0, Y = 0.0, Z = 0.0, SpatialReference = myMap.Map.SpatialReference};IElement elem = null;ITextElement txtElement = new TextElementClass();element = textElement as IElement;ITextSymbol textSymbol = new TextSymbolClass();textSymbol.Color = color;textSymbol.Size = 16;textSymbol.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(new Font("Arial" , 16 , FontStyle.Bold);element.Geometry = point as IGeometry;textSymbol.Text = "My Test Text";txtElement.Symbol = textSymbol;((ITextElement)element).Symbol = textSymbol;IGrpahicsLayer graphicsLayer = new CompositeGraphicsLayerClass();((ILayer)graphicsLayer).Name = "Text Layer";IGraphicsContainer graphicsContainer = graphicsLayer as IGraphicsContainer;graphicsContainer.AddElement(element , 0);myMap.AddLayer(graphicsLayer as ILayer);((ILayer)graphicsLayer).Draw(esriDrawPhase.esriDPGeography , null , null);Any ideas?
أكثر...
Here is my code:
ArcDisplay.IRgbColor color = new RgbColorClass(){ Red = 255, Green = 255, Blue = 255};IPoint point = new PointClass(){ X = 0.0, Y = 0.0, Z = 0.0, SpatialReference = myMap.Map.SpatialReference};IElement elem = null;ITextElement txtElement = new TextElementClass();element = textElement as IElement;ITextSymbol textSymbol = new TextSymbolClass();textSymbol.Color = color;textSymbol.Size = 16;textSymbol.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(new Font("Arial" , 16 , FontStyle.Bold);element.Geometry = point as IGeometry;textSymbol.Text = "My Test Text";txtElement.Symbol = textSymbol;((ITextElement)element).Symbol = textSymbol;IGrpahicsLayer graphicsLayer = new CompositeGraphicsLayerClass();((ILayer)graphicsLayer).Name = "Text Layer";IGraphicsContainer graphicsContainer = graphicsLayer as IGraphicsContainer;graphicsContainer.AddElement(element , 0);myMap.AddLayer(graphicsLayer as ILayer);((ILayer)graphicsLayer).Draw(esriDrawPhase.esriDPGeography , null , null);Any ideas?
أكثر...