Good Morning -
I am trying to loop through all the items in a graphicscontainer and delete all items before recreating a new map.
My problem is that when the script runs, it deletes all text items but it does not delete the balloon callouts.
IGraphicsContainer graphicsContainer = pMxDocument.PageLayout as IGraphicsContainer;
IElement element = null;
graphicsContainer.Reset();
element = graphicsContainer.Next();
while (element != null)
{
if (!(element is IMapFrame))
{
//added this to see if it ever finds a balloon callout, but it doesn't
if (element is IBalloonCallout)
{
graphicsContainer.DeleteElement(element);
}
graphicsContainer.DeleteElement(element);
graphicsContainer.Reset();
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, element, pActiveView.Extent);
}
element = graphicsContainer.Next();
}
Any ideas?
Linda