ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Element Class / SetHeight Method
Double
Example

In This Topic
    SetHeight Method (Element)
    In This Topic
    Sets the height of the element. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overridable Sub SetHeight( _
       ByVal height As Double _
    ) 
    public virtual void SetHeight( 
       double height
    )

    Parameters

    height
    Double
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    This element requires its mapview to be active
    Remarks
    Placement for an element contained in graphics layer requires the mapview be active
    Example
    Create North Arrow From StyleItem 2
    {
      //Note: Must be on QueuedTask.Run
    
      //Build geometry
      Coordinate2D center = new Coordinate2D(7, 5.5);
    
      //Reference a North Arrow in a style
      StyleProjectItem stylePrjItm = Project.Current.GetItems<StyleProjectItem>()
                                     .FirstOrDefault(item => item.Name == "ArcGIS 2D");
      NorthArrowStyleItem naStyleItm = stylePrjItm.SearchNorthArrows(
                                             "ArcGIS North 10")[0];
    
      //Reference MF, create north arrow and add to layout 
    
      var mf = layout.FindElement("Map Frame") as MapFrame;
      var narrow_info = new NorthArrowInfo()
      {
        MapFrameName = mf.Name,
        NorthArrowStyleItem = naStyleItm
      };
      var arrowElm = (NorthArrow)ElementFactory.Instance.CreateMapSurroundElement(
        layout, center.ToMapPoint(), narrow_info) as NorthArrow;
      arrowElm.SetName("New North Arrow");
      arrowElm.SetHeight(1.75);
      arrowElm.SetX(7);
      arrowElm.SetY(6);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also