Hello,I am hoping for some help/advice.I am trying to get the ymax for a legend using c# but i the value returned is incorrect. The value for the width is correct though.Please can someone explain why this does not return the correct value for ymax and how i can obtain this value?Many thanks.
IGraphicsContainer graphicsContainer = mapDocument.PageLayout as IGraphicsContainer;
graphicsContainer.Reset();
IElement element = graphicsContainer.Next();
while (element != null)
{
if (element is IMapSurroundFrame)
{
IMapSurround mapSurround = ((IMapSurroundFrame)element).MapSurround;
if (mapSurround is ILegend)
{
IEnvelope newEnvelope = new Envelope() as IEnvelope;
mapSurround.QueryBounds(mapDocument.ActiveView.ScreenDisplay, element.Geometry.Envelope, newEnvelope);
MessageBox.Show(newEnvelope.Envelope.YMax.ToString());
MessageBox.Show(newEnvelope.Envelope.Width.ToString());