<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to change Background color of rectangular envelope containing a text in the Layout of ArcGIS Pro? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1031017#M6269</link>
    <description>&lt;P&gt;The solution you provided creates a rectangle, which is good. So, the only way I can achieve my result is to create another polyTxtElm and overlay on top of that rectangle you provided. THIS IS NOT THE BEST SOLUTION, but does the job.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	// Create Rectangle using polygon //
	CIMPolygonSymbol polySym = SymbolFactory.Instance
		.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB, 
			SimpleFillStyle.Solid);
	GraphicElement polyTxtElm = LayoutElementFactory.Instance
		.CreatePolygonGraphicElement(layout, poly);
	var g = new CIMPolygonGraphic
	{
		Polygon = poly,
		Symbol = polySym.MakeSymbolReference()                        
	};
	polyTxtElm.SetGraphic(g);					

	// Overlay Text over SAME polygon //
	CIMStroke outline = SymbolFactory.Instance
		.ConstructStroke(ColorFactory.Instance.BlackRGB, 0.5, 
			SimpleLineStyle.Solid);
	polySym = SymbolFactory.Instance
		.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB, 
			SimpleFillStyle.Solid, outline);
	CIMTextSymbol sym = SymbolFactory.Instance
		.ConstructTextSymbol(polySym, 10, "Tahoma", "Bold");
	sym.HorizontalAlignment = HorizontalAlignment.Center; 

	polyTxtElm = LayoutElementFactory.Instance
		.CreatePolygonParagraphGraphicElement(layout, 
                    poly, title, sym);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Feb 2021 16:55:15 GMT</pubDate>
    <dc:creator>GyanendraGurung</dc:creator>
    <dc:date>2021-02-26T16:55:15Z</dc:date>
    <item>
      <title>How to change Background color of rectangular envelope containing a text in the Layout of ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1030564#M6255</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                var theLayout = await QueuedTask.Run&amp;lt;Layout&amp;gt;(() =&amp;gt;
                {
                    //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&amp;lt;Coordinate2D&amp;gt;();
                    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;
                });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 17:38:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1030564#M6255</guid>
      <dc:creator>GyanendraGurung</dc:creator>
      <dc:date>2021-02-25T17:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Background color of rectangular envelope containing a text in the Layout of ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1030760#M6266</link>
      <description>&lt;P&gt;Did you try creating a graphic and assigning it to the element?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var polyTxtElm = LayoutElementFactory.Instance
    .CreatePolygonParagraphGraphicElement(layout, poly, title, sym);
// assign a graphic to the element:
var g = new CIMPolygonGraphic();
g.Polygon = poly;
g.Symbol = polySym.MakeSymbolReference();
polyTxtElm.SetGraphic(g);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 21:38:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1030760#M6266</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-02-25T21:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Background color of rectangular envelope containing a text in the Layout of ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1031017#M6269</link>
      <description>&lt;P&gt;The solution you provided creates a rectangle, which is good. So, the only way I can achieve my result is to create another polyTxtElm and overlay on top of that rectangle you provided. THIS IS NOT THE BEST SOLUTION, but does the job.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	// Create Rectangle using polygon //
	CIMPolygonSymbol polySym = SymbolFactory.Instance
		.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB, 
			SimpleFillStyle.Solid);
	GraphicElement polyTxtElm = LayoutElementFactory.Instance
		.CreatePolygonGraphicElement(layout, poly);
	var g = new CIMPolygonGraphic
	{
		Polygon = poly,
		Symbol = polySym.MakeSymbolReference()                        
	};
	polyTxtElm.SetGraphic(g);					

	// Overlay Text over SAME polygon //
	CIMStroke outline = SymbolFactory.Instance
		.ConstructStroke(ColorFactory.Instance.BlackRGB, 0.5, 
			SimpleLineStyle.Solid);
	polySym = SymbolFactory.Instance
		.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB, 
			SimpleFillStyle.Solid, outline);
	CIMTextSymbol sym = SymbolFactory.Instance
		.ConstructTextSymbol(polySym, 10, "Tahoma", "Bold");
	sym.HorizontalAlignment = HorizontalAlignment.Center; 

	polyTxtElm = LayoutElementFactory.Instance
		.CreatePolygonParagraphGraphicElement(layout, 
                    poly, title, sym);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 16:55:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1031017#M6269</guid>
      <dc:creator>GyanendraGurung</dc:creator>
      <dc:date>2021-02-26T16:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Background color of rectangular envelope containing a text in the Layout of ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1031041#M6270</link>
      <description>&lt;P&gt;It might be better to start from Esri's sample &lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Layouts#create-rectangle-text-with-more-advanced-symbol-settings" target="_self"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This works for me:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await QueuedTask.Run(() =&amp;gt;
{
    //Build 2D polygon geometry
    List&amp;lt;Coordinate2D&amp;gt; plyCoords = new List&amp;lt;Coordinate2D&amp;gt;();
    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
    //Also notice how formatting tags are using within the text string.
    CIMTextSymbol sym = SymbolFactory.Instance
        .ConstructTextSymbol
        (ColorFactory.Instance.WhiteRGB, 10, "Arial", "Regular");
    string text = @"Some Text String that is really long and is &amp;lt;BOL&amp;gt;forced to wrap to other lines&amp;lt;/BOL&amp;gt; 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);
    cimPolyTxtGra.Frame.BackgroundSymbol = new CIMSymbolReference();
    cimPolyTxtGra.Frame.BackgroundSymbol.Symbol = SymbolFactory.Instance
        .ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB);
    polyTxtElm.SetGraphic(polyTxtGra);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 17:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-change-background-color-of-rectangular/m-p/1031041#M6270</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-02-26T17:10:54Z</dc:date>
    </item>
  </channel>
</rss>

