ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / GraphicFactory Class / GetGraphicOutline Method
The parent container of the graphic's parent graphic element
The graphic to be outlined
Example

In This Topic
    GetGraphicOutline Method (GraphicFactory)
    In This Topic
    Get the outline geometry for the input CIMGraphic. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Geometry GetGraphicOutline( 
       IElementContainer container,
       CIMGraphic graphic
    )
    Public Function GetGraphicOutline( _
       ByVal container As IElementContainer, _
       ByVal graphic As CIMGraphic _
    ) As Geometry

    Parameters

    container
    The parent container of the graphic's parent graphic element
    graphic
    The graphic to be outlined

    Return Value

    The outline geometry
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Value cannot be null: container
    Container is not associated with the current view
    Remarks
    The graphic must belong to a graphic element participating in a layout or in a graphic layer. Refer to GraphicElement.GetGraphic to retrieve the ArcGIS.Core.CIM.CIMGraphic associated with a GraphicElement.The parent container must also be associated with the current active view (either LayoutView or MapView depending on whether the container is a layout or graphics layer) or an System.ArgumentException will be thrown.
    Example
    Get Graphic Outline
    //given a graphic, extract its outline geometry
    
    var graphic_outline = GraphicFactory.Instance.GetGraphicOutline(
                            layout, cim_graphic);
    //TODO - use the geometry - eg, make another graphic
    var outline_graphic = GraphicFactory.Instance.CreateSimpleGraphic(graphic_outline);
    //... etc.
    
    Get Graphic Outline from Graphic Element
    //given a graphic, extract its outline geometry
    
    var graphic_elem = layout.GetElementsAsFlattenedList().OfType<GraphicElement>()?.FirstOrDefault();
    if (graphic_elem != null)//can be point, line, poly, or text
      return;
    
    var outline = GraphicFactory.Instance.GetGraphicOutline(
                            layout, graphic_elem.GetGraphic());
    //create an element using the outline
    var elem = ElementFactory.Instance.CreateGraphicElement(
                        layout, outline);
    //... etc.
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also