I’m having trouble getting features colored properly using ValueStyles. I’ve looked through the samples and don’t see where I’ve made a mistake. Hopefully someone here can point it out. The behavior I’m seeing is that the ColumnName on the ValueStyle never seems to match with the Column on the Feature. I have verified the the column values do exist and contain matching data. They should match. The colors will change if I don’t set ColumnName on ValueStyle the first color is chosen and it does display. It just won’t match anything named. Any ideas?
Thanks,
Robert
Here’s the code.
'This populates the ValueStyle
dim oCVs as ValueStyle =
Nothing
oCVs =
New
ValueStyle
oCVs.ColumnName =
"CROP_NAME"
For
Each
oCP
In
gCropsColl
oColor = System.Drawing.ColorTranslator.FromWin32(
CInt
(oCP.Color))
oCVs.ValueItems.Add(
New
ValueItem(oCP.Name, AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(oColor.A, oColor.R, oColor.G, oColor.B), GeoColor.StandardColors.Black)))
Next
oLay.ZoomLevelSet.ZoomLevel17.CustomStyles.Add(oCVs)
'This traverses the features and sets the CROP_NAME value
For
Each
featCZ
In
oLay.InternalFeatures
oCZ = collCZs.Item(featCZ.Tag)
'get the object associated with the feature to find color code
featCZ.ColumnValues.Add(
“CROP_NAME”
, oCZ.CropCode)
Next