ArcGIS Pro 2.6 API Reference Guide
CreatePointTextGraphicElement(ILayoutElementContainer,Coordinate2D,String,CIMTextSymbol,Anchor) Method
Example 

ArcGIS.Desktop.Layouts Namespace > IElementFactory Interface > CreatePointTextGraphicElement Method : CreatePointTextGraphicElement(ILayoutElementContainer,Coordinate2D,String,CIMTextSymbol,Anchor) Method
Layout or GroupElement
Coordinate2D
String
CIMTextSymbol
Anchor
Creates a graphic point text element on a layout from a single 2D coordinate with an added parameter to set the text symbol. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Overloads Function CreatePointTextGraphicElement( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal coord2D As Coordinate2D, _
   Optional ByVal text As String, _
   Optional ByVal textSymbol As CIMTextSymbol, _
   Optional ByVal anchor As Anchor _
) As GraphicElement

Parameters

elementContainer
Layout or GroupElement
coord2D
Coordinate2D
text
String
textSymbol
CIMTextSymbol
anchor
Anchor

Return Value

Returns a GraphicElement.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
If the element container is a Layout then the element gets added to the root level of the layout TOC at the top most position. If the element container is a GroupElement then it gets added to the group at the topmost position.
Example
//Create a simple point text element and assign basic symbology and text settings.

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  //Build 2D point geometry
  Coordinate2D coord2D = new Coordinate2D(3.5, 10);

  //Set symbolology, create and add element to layout
  CIMTextSymbol sym = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.RedRGB, 32, "Arial", "Regular");
  string textString = "Point text";
  GraphicElement ptTxtElm = LayoutElementFactory.Instance.CreatePointTextGraphicElement(layout, coord2D, textString, sym);
  ptTxtElm.SetName("New Point Text");

  //Change additional text properties
  ptTxtElm.SetAnchor(Anchor.CenterPoint);
  ptTxtElm.SetX(4.5);
  ptTxtElm.SetY(9.5);
  ptTxtElm.SetRotation(45);
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

IElementFactory Interface
IElementFactory Members
Overload List