ArcGIS Pro二次开发-根据屏幕几个像素创建要素

 /// <summary>

    /// Create a circular polygon around a mappoint for with a radius in pixels.

    /// </summary>

    /// <param name="mapPoint">Center of the circle as a mappoint.</param>

    /// <param name="pixels">Circle radius in screen pixels.</param>

    /// <returns>A polygon geometry.</returns>

    private Polygon CreateSearchPolygon(MapPoint mapPoint, int pixels)

    {

      //get search radius

      var screenPoint = MapView.Active.MapToScreen(mapPoint);

      var radiusScreenPoint = new System.Windows.Point((screenPoint.X + pixels), screenPoint.Y);

      var radiusMapPoint = MapView.Active.ScreenToMap(radiusScreenPoint);

      var searchRadius = GeometryEngine.Instance.Distance(mapPoint, radiusMapPoint);



      //build a search circle geometry

      var cent = new Coordinate2D(mapPoint);

      var searchGeom = EllipticArcBuilder.CreateEllipticArcSegment(cent, searchRadius, esriArcOrientation.esriArcClockwise, MapView.Active.Map.SpatialReference);

      var searchPB = new PolygonBuilder(new[] { searchGeom });

      return searchPB.ToGeometry();

    }