The "too long; didn't read" of all of this: What are the formatting options available for displaying text and how do you access them?
For example, I have a CIMPage layout I'm working on that displays a few text blocks, a map, and a photograph. However, because CreateTextGraphicElement only seems to take a lower-left coordinate, I don't seem to have a way of limiting the final height of that text area. Example code is below:
Coordinate2D propDesc_ll = new Coordinate2D(.5, .5);
CIMTextSymbol txtFormat = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 10, "Arial");
TextElement propDescTxtElm = ElementFactory.Instance.CreateTextGraphicElement(
newLayout,
TextType.PointText,
propDesc_ll.ToMapPoint(),
txtFormat,
propertyData) as TextElement;
However, the propertyData could have a little bit of text, or a lot. When it has a lot, it overlaps a map that is above it, such as the image below:
(Ignore the white lines, just removing some personal data.) Now, once that's produced, I can click on the text area and resize it, but it'd be nice if it would either autosize, or I could calculate the size and resize it before placing (reducing the font size to make it fit, or whatever.)
Really, I guess I'd just like to give it an upper-right coordinate so that I could control the size. The attached file is the code for generating the layout.
It seems that you are correct that the default behavior is indeed to position the TextGraphicElement using the bottom left corner - and then, when creating it, to update the anchor point using ElementInfo after storing the point geometry. The API reference has examples where the text element is repositioned immediately after creation (using the new anchor point in ElementInfo), but I've not found any time where a different anchor point is used for a Point Text Element during initial creation.
Coordinate2D propDesc_ll = new Coordinate2D(.5, .5);
CIMTextSymbol txtFormat = SymbolFactory.Instance.ConstructTextSymbol(
ColorFactory.Instance.BlackRGB, 10, "Arial");
//use ElementInfo to set placement properties during create
var elemInfo = new ElementInfo() { Anchor = Anchor.TopRightCorner };
TextElement propDescTxtElm = ElementFactory.Instance.CreateTextGraphicElement(
newLayout,
TextType.PointText,
propDesc_ll.ToMapPoint(),
txtFormat,
propertyData,
elementInfo: elemInfo) as TextElement;
// elemInfo as optional parameter to set anchor
//Change the location using the new anchor position
propDescTxtElm.SetX(0.5);
propDescTxtElm.SetY(0.5);
Unfortunately, I'm unsure if that gives you the flexibility to control the size of the text area. A Rectangle Paragraph Text Element may provide more control over the bounding area for text.