IGraphicsContainer graphicsContainer = myPageLayout.ActiveView.GraphicsContainer; graphicsContainer.Reset(); IElement pElement = graphicsContainer.Next(); while (pElement != null) { if (pElement is IMapFrame) { // do something } }
Solved! Go to Solution.
Thanks Shuping,
Yes, in my code, I didn't include line: pElement = graphicsContainer.Next(); in the while loop.
In your code, you selected shapes of the pagelayout, right ? Is it ok if you add and select shapes within the Focus Map (MapFrame) of the pagelayout ?
Kind regards,
IGraphicsContainer graphicsContainer = axPageLayoutControl1.ActiveView.GraphicsContainer
IGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;
Thanks Shuping,
Yes, in my code, I didn't include line: pElement = graphicsContainer.Next(); in the while loop.
In your code, you selected shapes of the pagelayout, right ? Is it ok if you add and select shapes within the Focus Map (MapFrame) of the pagelayout ?
Kind regards,
IGraphicsContainer graphicsContainer = axPageLayoutControl1.ActiveView.GraphicsContainer
IGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;