1. I am trying to change the background of the rectangular area containing a text in ArcGIS Pro Layout. I am trying to figure out WHERE to insert WHAT in the following code to make that work.
2. The following code was my attempt to change the color of the envelope containing the text, but it actually changed the color of the text instead.
var theLayout = await QueuedTask.Run<Layout>(() =>
{
//Set up a page
CIMPage newPage = new CIMPage
{
Width = 420,
Height = 297,
Units = LinearUnit.Millimeters
};
Layout layout = LayoutFactory.Instance.CreateLayout(newPage);
#region Table
// Caption
title = "CAPTION";
plyCoords = new List<Coordinate2D>();
plyCoords.Add(new Coordinate2D(286, 271));
plyCoords.Add(new Coordinate2D(286, 277));
plyCoords.Add(new Coordinate2D(400, 277));
plyCoords.Add(new Coordinate2D(400, 271));
poly = PolygonBuilder.CreatePolygon(plyCoords);
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlackRGB, 0.5, SimpleLineStyle.Solid);
polySym = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB, SimpleFillStyle.Solid, outline);
sym = SymbolFactory.Instance.ConstructTextSymbol(polySym, 10, "Tahoma", "Bold");
sym.HorizontalAlignment = HorizontalAlignment.Center;
polyTxtElm = LayoutElementFactory.Instance.CreatePolygonParagraphGraphicElement(layout, poly, title, sym);
return layout;
});