ArcGIS Pro 3.3 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 CIMPictureGraphic CreatePictureGraphic( 
       Geometry frameOrLocation,
       string url
    )
    Public Function CreatePictureGraphic( _
       ByVal frameOrLocation As Geometry, _
       ByVal url As String _
    ) As CIMPictureGraphic

    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
    //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);
    
    //Create and add element to layout
    //string picPath = ApplicationUtilities.BASEPATH + _settings.baseFolder + "irefusetowatchthismovi�.jpg";
    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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also