Maybe try calling ITransform2D.Move(0,0) on the legend's mapsurroundframe.If 0,0 doesn't work, try moving twice, once forward, and then backwards.
IGraphicsContainer graphicsContainer = (IGraphicsContainer)MapDocument.PageLayout; graphicsContainer.Reset(); IElementProperties2 elementProperties = (IElementProperties2)graphicsContainer.Next(); while (elementProperties != null) { if (elementProperties.Name == "LEGEND") { IMapSurroundFrame mapSurroundFrame = (IMapSurroundFrame)elementProperties; ILegend2 legend = (ILegend2)mapSurroundFrame.Object; ITransform2D trans = (ITransform2D) mapSurroundFrame; trans.Move(0, 0); trans.Move(1, 0); trans.Move(-1, 0); trans.Move(0, 0); mapSurroundFrame.MapSurround.Refresh(); legend.Refresh(); return; } elementProperties = (IElementProperties2)graphicsContainer.Next(); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.