ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / GraphicFactory Class / CreatePictureGraphic Method
The picture graphic envelope (frame) or center point
The url of the image to use
Example

In This Topic
    CreatePictureGraphic Method (GraphicFactory)
    In This Topic
    Creates a picture graphic element based on the input geometry and symbol. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function CreatePictureGraphic( _
       ByVal frameOrLocation As Geometry, _
       ByVal url As String _
    ) As CIMPictureGraphic
    public CIMPictureGraphic CreatePictureGraphic( 
       Geometry frameOrLocation,
       string url
    )

    Parameters

    frameOrLocation
    The picture graphic envelope (frame) or center point
    url
    The url of the image to use

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    empty or null geometry
    geometry must be point or envelope
    empty or null url
    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 Picture Graphic
    {
      //Note: Must be on QueuedTask.Run
      //Build geometry
      Coordinate2D ll = new Coordinate2D(3.5, 1);
      Coordinate2D ur = new Coordinate2D(5.5, 2);
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur);
      string picPath = System.IO.Path.Combine(
      Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "SamplePicture.jpg");
      //Create and add element to layout
      var graphic = GraphicFactory.Instance.CreatePictureGraphic(env.Center, picPath);
    
      //Make an element to add to GraphicsLayer or Layout
      //var ge = ElementFactory.Instance.CreateGraphicElement(layout, graphic);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also