ArcGIS Pro-SetCustomFullExtent

LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Standard"));
Layout layout = layoutItem.GetLayout();
MapFrame mapFrame = layout.FindElement("FrameName") as MapFrame;
//Get map 
var mapFrameMap = mapFrame.Map;
//Get the specific layer you want from the map
var lyrOfInterest = mapFrameMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();

using (RowCursor jCursor1 = ExtentFeatureClass.Search(queryFilter, true))
{
while (jCursor1.MoveNext())
{

var RTSNUM = "RTSNumber";
using (Feature feature = (Feature)jCursor1.Current)
{
// Process the feature. For example...
var pin = feature[RTSNUM].ToString();
Geometry geo2 = feature.GetShape().Clone();
var selectionEnvelope2 = geo2.Extent;
mapFrameMap.SetCustomFullExtent(selectionEnvelope2);
mapFrame.SetCamera(selectionEnvelope2);
原文地址:https://www.cnblogs.com/gisoracle/p/12629157.html