Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm doing a vb.net button to run in ARCGIS. the button is working, the problem is as I'm working in the layot when I press the button, change the layout coordinates and the map coordinates. Is a way that the layout view don't move and keep the Coordinates (0,0)

I leave the code:

MxDoc = My.ArcMap.Document

ActiveView = MxDoc.ActiveView

Dim x As Double = txtEast.Text

Dim y As Double = txtNorth.Text

Map.MapScale = 4000 'zoom to this scale

Envelope = ActiveView.Extent

,Create and Add the point coordinates
Point = New ESRI.ArcGIS.Geometry.Point
Point.PutCoords(x, y)

'Envelope Position go to the middle of the point
Envelope.CenterAt(Point)


'Refresh View
 ActiveView.Extent = Envelope
 MxDoc.ActiveView.Refresh()Map = MxDoc.FocusMap

Thank You!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Instead of setting the ActiveView to MxDoc.ActiveView, which could be either an IMap or IPageLayout, set it to MxDoc.FocusMap

Update

What changes did you make to you code? This code will move the map but not the layout

        Dim pMap As ESRI.ArcGIS.Carto.IMap = My.ArcMap.Document.FocusMap
        Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView = pMap
        Dim pEnvelope As ESRI.ArcGIS.Geometry.IEnvelope = pActiveView.Extent
        Dim pPoint As New ESRI.ArcGIS.Geometry.Point

        pPoint.PutCoords(x, y)
        pEnvelope.CenterAt(pPoint)

        pActiveView.Extent = pEnvelope
        pMap.MapScale = 4000
        pActiveView.Refresh()
share|improve this answer
    
Thank you, but it still doesn't work, the layout is still moving. –  TitoGIS Dec 13 '12 at 22:15
    
It breaks when I change the activeview to Map... the problem is that I have to work in the layout view. I think that after do my command I should do "zoom to whole page", but I don't have any idea how to connect it. By the way, thank you very much! –  TitoGIS Dec 14 '12 at 16:04
    
I've tested this code while in layout view and it works properly. Can you post the new code you're using? –  kenbuja Dec 14 '12 at 16:46
    
Hello again... now I don't know why is working, instead to modify my code I just copy yours and works. Thank Very much! –  TitoGIS Dec 15 '12 at 12:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.