ArcGIS Pro 2.9 API Reference Guide
CreatePolygonParagraphGraphicElement(ILayoutElementContainer,Polygon,String,CIMTextSymbol) Method
Example 

ArcGIS.Desktop.Layouts Namespace > LayoutElementFactory Class > CreatePolygonParagraphGraphicElement Method : CreatePolygonParagraphGraphicElement(ILayoutElementContainer,Polygon,String,CIMTextSymbol) Method
Layout or GroupElement
Polygon
String
CIMTextSymbol
Creates a graphic polygon text element on a layout from a polygon geometry with an added parameter to set the text symbol. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Function CreatePolygonParagraphGraphicElement( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal polygon As Polygon, _
   Optional ByVal text As String, _
   Optional ByVal textSymbol As CIMTextSymbol _
) As GraphicElement

Parameters

elementContainer
Layout or GroupElement
polygon
Polygon
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 polygon paragraph text with basic text properties.

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  //Build geometry
  List<Coordinate2D> plyCoords = new List<Coordinate2D>();
  plyCoords.Add(new Coordinate2D(3.5, 7));
  plyCoords.Add(new Coordinate2D(4.5, 7));
  plyCoords.Add(new Coordinate2D(4.5, 6.7));
  plyCoords.Add(new Coordinate2D(5.5, 6.7));
  plyCoords.Add(new Coordinate2D(5.5, 6.1));
  plyCoords.Add(new Coordinate2D(3.5, 6.1));
  Polygon poly = PolygonBuilder.CreatePolygon(plyCoords);

  //Set symbolology, create and add element to layout
  CIMTextSymbol sym = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.GreyRGB, 10, "Arial", "Regular");
  string text = "Some Text String that is really long and is <BOL>forced to wrap to other lines</BOL> so that we can see the effects." as String;
  GraphicElement polyTxtElm = LayoutElementFactory.Instance.CreatePolygonParagraphGraphicElement(layout, poly, text, sym);
  polyTxtElm.SetName("New Polygon Text");

  //(Optionally) Modify paragraph border 
  CIMGraphic polyTxtGra = polyTxtElm.GetGraphic();
  CIMParagraphTextGraphic cimPolyTxtGra = polyTxtGra as CIMParagraphTextGraphic;
  cimPolyTxtGra.Frame.BorderSymbol = new CIMSymbolReference();
  cimPolyTxtGra.Frame.BorderSymbol.Symbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.GreyRGB, 1.0, SimpleLineStyle.Solid);
  polyTxtElm.SetGraphic(polyTxtGra);
});
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

LayoutElementFactory Class
LayoutElementFactory Members
Overload List