Use the SpatialReferenceDialog to change the coordinate system or spatial reference of the map.
[C#]
///<summary>Use the SpatialReferenceDialog to change the coordinate system or spatial reference of the map.</summary> /// ///<param name="hWnd">The application window handle.</param> ///<param name="map">An IMap interface.</param> /// ///<remarks></remarks> public void ChangeMapSpatialReference(System.Int32 hWnd, ESRI.ArcGIS.Carto.IMap map) { if(map == null) { return; } ESRI.ArcGIS.CatalogUI.ISpatialReferenceDialog2 spatialReferenceDialog = new ESRI.ArcGIS.CatalogUI.SpatialReferenceDialogClass(); ESRI.ArcGIS.Geometry.ISpatialReference spatialReference = spatialReferenceDialog.DoModalCreate(true, false, false, hWnd); if ((!(map.SpatialReferenceLocked))) { map.SpatialReference = spatialReference; } }
[Visual Basic .NET]
'''<summary>Use the SpatialReferenceDialog to change the coordinate system or spatial reference of the map.</summary> ''' '''<param name="hWnd">The application window handle.</param> '''<param name="map">An IMap interface.</param> ''' '''<remarks></remarks> Public Sub ChangeMapSpatialReference(ByVal hWnd As System.Int32, ByVal map As ESRI.ArcGIS.Carto.IMap) If map Is Nothing Then Return End If Dim spatialReferenceDialog As ESRI.ArcGIS.CatalogUI.ISpatialReferenceDialog2 = New ESRI.ArcGIS.CatalogUI.SpatialReferenceDialogClass Dim spatialReference As ESRI.ArcGIS.Geometry.ISpatialReference = spatialReferenceDialog.DoModalCreate(True, False, False, hWnd) If (Not (map.SpatialReferenceLocked)) Then map.SpatialReference = spatialReference End If End Sub