Hello,
For my application, there is a requirement to show polygon labels and for esthetic reasons, those labels should be shown within polygon boundary or hidden if they can not fit. I have tried to configure TextStyle for the label field in a number of multiple ways to prevent labels from showing outside of territory boundary but to no affect.
Here is a code snippet defining parameters for the labels:
return new TextStyle
{
TextColumnName = LabelField,
TextSolidBrush = new GeoSolidBrush(TerritoryLabelColor),
HaloPen = new GeoPen(TerritoryLabelHaloColor, TerritoryLabelHaloSize),
Font = new GeoFont(TerritoryLabelFont, TerritoryLabelFontSize, TerritoryLabelDrawingFontStyle),
PolygonLabelingLocationMode = PolygonLabelingLocationMode.Centroid,
SuppressPartialLabels = true,
FittingPolygon = true,
FittingPolygonFactor = 0.9
};
Even after those settings, some labels still show up outside of polygon boundaries (or even bounding-box boundaries). A sample can be seen below - labels outside of polygon are highlighted