ESRI.ArcGIS.ADF.IMS
TextSymbol Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Display.Symbol Namespace : TextSymbol Class




A LabelSymbol used to label point, line, and polygon layers.

Object Model


Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class TextSymbol 
   Inherits LabelSymbol
Visual Basic (Usage)Copy Code
Dim instance As TextSymbol
C# 
[SerializableAttribute()]
public class TextSymbol : LabelSymbol 

Example

This example creates a new TextSymbol, and uses it in a new SimpleLabelRenderer to replace the labels for a city layer. As is typical with map layers, the layer has a GroupRenderer to display both layer symbols and labels, so the example replaces the label renderer with a new one.
Visual BasicCopy Code
' Create a new text symbol and set its properties

Dim textSymb As New TextSymbol()

textSymb.Font = New FontInfo("Arial", 16, Drawing.Color.Red, FontStyle.Italic)

textSymb.Antialiasing = True

textSymb.GlowColor = Drawing.Color.Bisque

textSymb.Interval = 2

textSymb.ShadowColor = Drawing.Color.Gray

textSymb.TextCasing = TextCasing.TitleCaps

textSymb.Transparency = 30



' Retrieve an existing layer

Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")



' Create new label renderer

Dim labelRend As New SimpleLabelRenderer("NAME")

labelRend.Symbol = textSymb



' Replace the existing label renderer with the new one

' -- Layer has a symbol renderer as well as a label renderer, in a GroupRenderer

Dim groupRend As GroupRenderer = layer.Renderer

groupRend.Renderers.RemoveAt(1) ' label renderer is second renderer

groupRend.Renderers.Add(labelRend)

C#Copy Code
// Create a new text symbol and set its properties 

TextSymbol textSymb = new TextSymbol(); 

textSymb.Font = new FontInfo("Arial", 16, Drawing.Color.Red, FontStyle.Italic); 

textSymb.Antialiasing = true; 

textSymb.GlowColor = Drawing.Color.Bisque; 

textSymb.Interval = 2; 

textSymb.ShadowColor = Drawing.Color.Gray; 

textSymb.TextCasing = TextCasing.TitleCaps; 

textSymb.Transparency = 30; 

  

// Retrieve an existing layer 

FeatureLayer layer = mapView.Layers.FindByName("Cities"); 

  

// Create new label renderer 

SimpleLabelRenderer labelRend = new SimpleLabelRenderer("NAME"); 

labelRend.Symbol = textSymb; 

  

// Replace the existing label renderer with the new one 

//   -- Layer has a symbol renderer as well as a label renderer, in a GroupRenderer 

GroupRenderer groupRend = layer.Renderer; 

groupRend.Renderers.RemoveAt(1);     // label renderer is second renderer 

groupRend.Renderers.Add(labelRend); 

    

Remarks

TextSymbol is the simplest way to label map features. See LabelSymbol for other label types.

Not valid for use with ArcMap Server image services.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Display.Symbol.Symbol
      ESRI.ArcGIS.ADF.IMS.Display.Symbol.LabelSymbol
         ESRI.ArcGIS.ADF.IMS.Display.Symbol.TextSymbol

See Also

© 2010 All Rights Reserved.