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

ArcGIS.Desktop.Layouts Namespace > LayoutElementFactory Class > CreatePointTextGraphicElement Method : CreatePointTextGraphicElement(ILayoutElementContainer,Coordinate2D,String,CIMTextSymbol) Method
Layout or GroupElement
Coordinate2D
String
CIMTextSymbol
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
Public Overloads Function CreatePointTextGraphicElement( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal coord2D As Coordinate2D, _
   Optional ByVal text As String, _
   Optional ByVal textSymbol As CIMTextSymbol _
) As GraphicElement

Parameters

elementContainer
Layout or GroupElement
coord2D
Coordinate2D
text
String
textSymbol
CIMTextSymbol

Return Value

Returns a GraphicElement.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Map has reached maximum graphics count limit of 4000 elements. One or more elements cannot be created.
Map has reached maximum graphics size limit of 10 MB. One or more elements cannot be created.
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

See Also

Reference

LayoutElementFactory Class
LayoutElementFactory Members
Overload List