Esri's help for this method specifies this as LPUNKNOWN, which is rather unhelpful since I don't speak COM. I've tried an envelope, a geometry, and a graphicsContainer; each time receiving "System.ArgumentException: Value does not fall within the expected range.". Can't find any meaningful examples. Here's my MCVE . . .

IMap newDataFrame = new Map
    Name = "New Data Frame",
    SpatialReference = CurrentMap.SpatialReference
var viewRefresh = (IViewRefresh) newDataFrame;
var graphicsContainer = (IGraphicsContainer) newDataFrame;
var pointMaker = IdioticThingWithWhichYouNeedNotConcernYourself();
for (int i = 0; i < 5000; i++) 
    IMarkerElement element = pointMaker.MakePoint(out var envelope);
    graphicsContainer.AddElement((IElement)element, 0);
    // Also tried viewRefresh.RefreshItem(envelope);

I figure it's questionable (at best) to refresh even a tiny portion of a map 5000 times, but this is just tinkering so please humor me on that point. Regardless, the exception noted above is thrown the first time through the loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.