ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / ArrowInfo Class / ArrowHeadKey Property
Example

In This Topic
    ArrowHeadKey Property
    In This Topic
    Gets and sets the arrowhead key for the respective arrow head marker from the DefaultArrowStyleName
    Syntax
    public string ArrowHeadKey {get; set;}
    Public Property ArrowHeadKey As String
    Exceptions
    ExceptionDescription
     
    Remarks
    Supported arrowhead keys are in the DefaultArrowHeadKeys collection. The arrowhead key controls the style of arrowhead to be created. Currently arrowhead keys are limited to the arrowhead keys found in DefaultArrowStyleName. The arrowhead automatically defaults to DefaultArrowHeadKey unless it is set to a different value (from the DefaultArrowHeadKeys list). Attempting to set ArrowHeadKey to a key value not within the DefaultArrowHeadKeys collection will throw an System.InvalidOperationException
    Example
    Create Arrow Graphic
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    List<Coordinate2D> plCoords = new List<Coordinate2D>();
    plCoords.Add(new Coordinate2D(1, 8.5));
    plCoords.Add(new Coordinate2D(1.66, 9));
    plCoords.Add(new Coordinate2D(2.33, 8.1));
    plCoords.Add(new Coordinate2D(3, 8.5));
    Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
    //Set up the arrow info
    var arrowInfo = new ArrowInfo()
    {
      ArrowHeadKey = ArrowInfo.DefaultArrowHeadKeys[1],
      ArrowOnBothEnds = true,
      ArrowSizePoints = 30,
      LineWidthPoints = 15
    };
    
    var graphic = GraphicFactory.Instance.CreateArrowGraphic(linePl, arrowInfo);
    
    //Make an element to add to GraphicsLayer or Layout
    //var ge = ElementFactory.Instance.CreateGraphicElement(
    //  container, graphic, "Arrow Line", false);
    Create Line Arrow Element
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    List<Coordinate2D> plCoords = new List<Coordinate2D>();
    plCoords.Add(new Coordinate2D(1, 8.5));
    plCoords.Add(new Coordinate2D(1.66, 9));
    plCoords.Add(new Coordinate2D(2.33, 8.1));
    plCoords.Add(new Coordinate2D(3, 8.5));
    Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
    var arrowInfo = new ArrowInfo()
    {
      ArrowHeadKey = ArrowInfo.DefaultArrowHeadKeys[8],
      ArrowOnBothEnds = true,
      ArrowSizePoints = 24,
      LineWidthPoints = 12
    };
    
    //Create and add element to layout
    GraphicElement lineElm = ElementFactory.Instance.CreateArrowGraphicElement(
      container, linePl, arrowInfo, "Arrow Line", true, 
                                new ElementInfo() { Rotation = 15.0 });
    //lineElm.SetName("New Line");
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also