How do you set the horizontal alignment of a TextSymbol on a layout?

01-27-2020 08:59 AM
Occasional Contributor

This is the code that I am using and it is not changing the alignments on the text symbol position properties.

string mapTitle = "Notification Labels\r\n" + prjName + "\r\nBuffer: " + SizeUnits;
Coordinate2D titleTxt_ll = new Coordinate2D(2.9538, 9.9116);
CIMTextSymbol arial18bold = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 18, "Arial", "Bold");
arial18bold.HorizontalAlignment = ArcGIS.Core.CIM.HorizontalAlignment.Center;
arial18bold.VerticalAlignment = ArcGIS.Core.CIM.VerticalAlignment.Top;
GraphicElement titleTxtElm = LayoutElementFactory.Instance.CreatePointTextGraphicElement(newLayout, titleTxt_ll, mapTitle, arial18bold);
titleTxtElm.SetName("Title Text");

0 Kudos
1 Reply
Esri Regular Contributor

Hi Michael,

I see this problem in 2.4. The alignments set in code are not reflected in the text element in the Layout. But the good news is that this is now fixed in 2.5. Pro 2.5 will be available next week.