A class that represents an exact value in ValueMapLabelRenderer.
Object Model
Syntax
Example
The following example displays the names of capitals and non-capitals with different font and label characteristics. A ValueMapLabelRenderer is created, and two UniqueLabelValue objects are created, one for capitals and one for non-capitals. These are added to the renderer, and the renderer is assigned to the existing cities layer.
Visual Basic | Copy Code |
---|
' Create a new ValueMapLabelRenderer and set value and label fields
Dim valueMapLblRend As New ValueMapLabelRenderer()
valueMapLblRend.ValueField = "CAPITAL"
valueMapLblRend.LabelField = "NAME"
Dim textFont As FontInfo
Dim uniqueValue As UniqueLabelValue
' Create unique values for capitals and non-capitals
uniqueValue = New UniqueLabelValue()
uniqueValue.Value = "Y"
uniqueValue.SymbolLabel = "Capital"
uniqueValue.ComparisonMethod = ComparisonMethod.IsExact
textFont = New FontInfo("Arial", 18, Drawing.Color.Red, FontStyle.Bold)
uniqueValue.Symbol = New TextSymbol(textFont, TextCasing.AllUpper, Drawing.Color.Empty)
valueMapLblRend.Values.Add(uniqueValue)
uniqueValue = New UniqueLabelValue()
uniqueValue.Value = "N"
uniqueValue.SymbolLabel = "Non-capital"
uniqueValue.ComparisonMethod = ComparisonMethod.IsExact
textFont = New FontInfo("Arial", 11, Drawing.Color.Gray, FontStyle.Regular)
uniqueValue.Symbol = New TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty)
valueMapLblRend.Values.Add(uniqueValue)
' Assign the ValueMapLabelRenderer to an existing point layer
Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")
layer.Renderer = valueMapLblRend |
C# | Copy Code |
---|
// Create a new ValueMapLabelRenderer and set value and label fields
ValueMapLabelRenderer valueMapLblRend = new ValueMapLabelRenderer();
valueMapLblRend.ValueField = "CAPITAL";
valueMapLblRend.LabelField = "NAME";
FontInfo textFont;
UniqueLabelValue uniqueValue;
// Create unique values for capitals and non-capitals
uniqueValue = new UniqueLabelValue();
uniqueValue.Value = "Y";
uniqueValue.SymbolLabel = "Capital";
uniqueValue.ComparisonMethod = ComparisonMethod.IsExact;
textFont = new FontInfo("Arial", 18, Drawing.Color.Red, FontStyle.Bold);
uniqueValue.Symbol = new TextSymbol(textFont, TextCasing.AllUpper, Drawing.Color.Empty);
valueMapLblRend.Values.Add(uniqueValue);
uniqueValue = new UniqueLabelValue();
uniqueValue.Value = "N";
uniqueValue.SymbolLabel = "Non-capital";
uniqueValue.ComparisonMethod = ComparisonMethod.IsExact;
textFont = new FontInfo("Arial", 11, Drawing.Color.Gray, FontStyle.Regular);
uniqueValue.Symbol = new TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty);
valueMapLblRend.Values.Add(uniqueValue);
// Assign the ValueMapLabelRenderer to an existing point layer
FeatureLayer layer = mapView.Layers.FindByName("Cities");
layer.Renderer = valueMapLblRend; |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also