ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.Presentations Namespace / PresentationElementFactory Class / CreatePictureGraphicElement Method
The parent element container. It can be a presentation page or a group element that is associated with a presentation page.
The picture graphic envelope (frame) or center point
The url of the image to use
An element name (optional)
Select after create flag (default is true) (optional)
Additional element properties (optional)
Example

In This Topic
    CreatePictureGraphicElement Method (PresentationElementFactory)
    In This Topic
    Creates a picture graphic element based on the input geometry and symbol.
    Syntax
    Public Function CreatePictureGraphicElement( _
       ByVal elementContainer As IElementContainer, _
       ByVal frameOrLocation As Geometry, _
       ByVal url As String, _
       Optional ByVal elementName As String, _
       Optional ByVal select As Boolean, _
       Optional ByVal elementInfo As ElementInfo _
    ) As GraphicElement

    Parameters

    elementContainer
    The parent element container. It can be a presentation page or a group element that is associated with a presentation page.
    frameOrLocation
    The picture graphic envelope (frame) or center point
    url
    The url of the image to use
    elementName
    An element name (optional)
    select
    Select after create flag (default is true) (optional)
    elementInfo
    Additional element properties (optional)

    Return Value

    Remarks
    If a point is specified, the picture frame is sized to the extent of the content. If an envelope is specified, the content is sized to fit the extent of the frame.
    Example
    Create elements on a presentation page
    //Must be on QueuedTask
    await QueuedTask.Run(() =>
    {
      //create a picture element
      var imgPath = @"https://www.esri.com/content/dam/esrisites/en-us/home/" +
       "homepage-tile-podcast-business-resilience-climate-change.jpg";
    
      //Build a geometry to place the picture
      Coordinate2D ll = new Coordinate2D(3.5, 1);
      Coordinate2D ur = new Coordinate2D(6, 5);
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur);
      //create a picture element on the page
      var gElement = PresentationElementFactory.Instance.CreatePictureGraphicElement(page, env, imgPath);
    
      //create a text element
      //Set symbology, create and add element to a presentation page
      CIMTextSymbol sym = SymbolFactory.Instance.ConstructTextSymbol(
                    ColorFactory.Instance.RedRGB, 15, "Arial", "Regular");
      //use ElementInfo to set placement properties
      var elemInfo = new ElementInfo()
      {
        Anchor = Anchor.CenterPoint,
        Rotation = 45
      };
      string textString = "My text";
      var textPos = new Coordinate2D(5, 3).ToMapPoint();
      var tElement = PresentationElementFactory.Instance.CreateTextGraphicElement(page,
        TextType.PointText, textPos, sym, textString, "telement", false, elemInfo);
    
      //create a group element with elements created above
      var elmList = new List<Element> { gElement, tElement };
      GroupElement grp1 = PresentationElementFactory.Instance.CreateGroupElement(page, elmList, "My Group");
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.5 or higher.
    See Also