Hi Chuck,
If what I am guessing is correct, you are a complicate fields for a text style. If yes, here is a solution for your case. For instance, we defined a complicated fields like:
string complicateFields = “[FENAME]” + Environment.NewLine + “[FETYPE]” + Environment.NewLine + “[LENGTH]”;
Then, we register the DrawingFeatures event and apply this field to the textstyle:
ShapeFileFeatureLayer austinStreetsLabelLayer =
new
ShapeFileFeatureLayer(@
"…\SampleData\Data\austinstreets.shp"
);
austinStreetsLabelLayer.DrawingFeatures +=
new
EventHandler<DrawingFeaturesEventArgs>(austinStreetsLabelLayer_DrawingFeatures);
TextStyle labelText =
new
TextStyle(complicateFields,
new
GeoFont(
“Arial”
, 12),
new
GeoSolidBrush(GeoColor.SimpleColors.Black));
labelText.Mask = AreaStyles.Forest1;
void
austinStreetsLabelLayer_DrawingFeatures(
object
sender, DrawingFeaturesEventArgs e)
{
foreach
(Feature item
in
e.FeaturesToDraw)
{
string
complexColumnValue = item.ColumnValues[complicateFields];
string
[] splitNewLine =
new
string
[]{Environment.NewLine};
string[] trimFields = complexColumnValue.Split(splitNewLine,StringSplitOptions.RemoveEmptyEntries); // remove the space field and the new line charactors
item.ColumnValues[complicateFields] =
string
.Join(Environment.NewLine, trimFields);
}
}
With the above method, we can filter the empty field and the line. The below is the result:
If that is not what you are looking for, would you please attach your codes on how to define the label styles?
Thanks,
Troy