Report Inappropriate Content
Top Print
This Forum is closed for replies.
 |
| Subject |
Re: Label Expression Question |
| Author |
Tim Whiteaker |
| Date |
Nov 23, 2004 |
| Message |
The fact that all your labels come up as zero leads me to believe that an integer is still being fed as the label expression. For example, if the expression read
int(myfield)
then all labels would be zero, because "myfield" would be assumed to be a new variable, initialized as zero. int(0) = 0, so all labels would be zero.
The code below is working for me. If you try the code below and it still doesn't work for you, then I'm stumped.
Note that I'm testing this in ArcMap VBA, and I'm not using a MapControl (thus, the two lines involving the MapControl are different in the version I'm actually testing). |
| |
Dim pGeoLayer As IGeoFeatureLayer
Set pGeoLayer = MapControl1.Layer(0)
Dim pLabelEngine As ILabelEngineLayerProperties
pGeoLayer.AnnotationProperties.Clear
Set pLabelEngine = New LabelEngineLayerProperties
Dim sLabel As String
sLabel = "int([" & "SHAPE_area" & "])"
pLabelEngine.Expression = sLabel
pLabelEngine.IsExpressionSimple = True
Dim pBOLayerProps As IBasicOverposterLayerProperties
Set pBOLayerProps = New BasicOverposterLayerProperties
pBOLayerProps.NumLabelsOption = esriOneLabelPerShape
Set pLabelEngine.BasicOverposterLayerProperties = pBOLayerProps
pGeoLayer.AnnotationProperties.Add pLabelEngine
pGeoLayer.DisplayAnnotation = True
MapControl1.ActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing
|
| |
Tim Whiteaker
Research Associate
The University of Texas at Austin |
| |
|