Hello,
I am adding legends to our map, and am having issues with the text aligment. If the legend item spans the entire width of the map, as some of ours do, and the item only contains text, with no images, I can't get the text to left-justify. It either shows up indented a good bit, or, in some cases, we have seen it draw correctly initially, and then once anything is done to the map, if the extent is changed at all, the legend item redraws with the text indented again. When creating legend items that don't span the entire width, I can add a new LegendItem to LedendAdornmentLayer, and the text will be left-aligned as expected.
Here is the code that is currently not working as expected:
Dim stormInfoBoxLayer As New LegendAdornmentLayer
stormInfoBoxLayer.Name = layerName_StormInfoLegend
stormInfoBoxLayer.BackgroundMask = AreaStyles.CreateLinearGradientStyle(New GeoColor(255, 255, 255, 255), New GeoColor(255, 230, 230, 230), 90, GeoColor.SimpleColors.Black)
stormInfoBoxLayer.Location = AdornmentLocation.LowerRight
stormInfoBoxLayer.Height = lineHeight + 8
stormInfoBoxLayer.Width = Me.Map.Width
Dim sibItemText As New LegendItem
sibItemText.TextStyle = New TextStyle(stormInfoText, New GeoFont("Arial", 9, DrawingFontStyles.Regular), New GeoSolidBrush(GeoColor.SimpleColors.Black))
sibItemText.ImageJustificationMode = LegendImageJustificationMode.JustifyImageRight
sibItemText.Height = lineHeight
sibItemText.TextLeftPadding = 0
sibItemText.TextTopPadding = 1
sibItemText.TextBottomPadding = 1
sibItemText.TopPadding = 0
sibItemText.BottomPadding = 0
stormInfoBoxLayer.LegendItems.Add(layerName_StormInfoLegend, sibItemText)
Me.Map.AdornmentOverlay.Layers.Add(layerName_StormInfoLegend, stormInfoBoxLayer)