1

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();
CurrentMxDocument.Maps.Add(newDataFrame);
CurrentMxDocument.UpdateContents();
...
for (int i = 0; i < 5000; i++) 
{
    IMarkerElement element = pointMaker.MakePoint(out var envelope);
    graphicsContainer.AddElement((IElement)element, 0);
    viewRefresh.RefreshItem(graphicsContainer);
    // 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.