Hi ,
I implement Funtion CenterAndZoom of ZoomToResolution(Double,MapPoint) Method. When I rum my application in my computer with resolution 144x 900 work fine. But when I change resolution screen to 1920 x 1080 the Method isn´t work. Teache how can i do?. Attach the Method
private void CenterAndZoom(ESRI.ArcGIS.Client.Map myMap, ESRI.ArcGIS.Client.Geometry.MapPoint myMapPoint, double myResolution)
{
// Set a default value to determine whether to 'zoom and center' or just pan.
double ratio = 0.1;
// Ensure that we only have a map with a non-zero Resolution in order to calculate a new ratio for re-centering.
if (myMap.Resolution != 0.1)
{
// Create the ratio used to re-center the map
ratio = myResolution / myMap.Resolution;
}
if (ratio == 0.0)
{
// Just perform a pan without zooming in.
myMap.PanTo(myMapPoint);
}
else
{
// Get the current extent of the map.
ESRI.ArcGIS.Client.Geometry.Envelope myEnvelope = myMap.Extent;
// Get the current center of the maps extent.
ESRI.ArcGIS.Client.Geometry.MapPoint centerMapPoint = myEnvelope.GetCenter();
// Calculate the X,Y coordinates for the new map extent center.
double X = (myMapPoint.X - ratio * centerMapPoint.X) / (1 - ratio);
double Y = (myMapPoint.Y - ratio * centerMapPoint.Y) / (1 - ratio);
ESRI.ArcGIS.Client.Geometry.MapPoint newMapPoint = new ESRI.ArcGIS.Client.Geometry.MapPoint(X, Y);
// Zoom in and re-center the map.
myMap.ZoomToResolution(myResolution, newMapPoint);
}
}