Can not zoom with openstreetmap

Topics: Windows Forms
Sep 5, 2012 at 11:28 AM

here is my code i can see the map but can not zoom in and out

            PointLatLng position = new PointLatLng(lat, long);

            gMapControl1.SetCurrentPositionByKeywords("USA");
            gMapControl1.Zoom = 17;
            gMapControl1.MapProvider = OpenStreetMapProvider.Instance;
            gMapControl1.Position = position;

            GMapOverlay overlay = new GMapOverlay(gMapControl1, "1");
            overlay.Markers.Add(new GMapMarkerGoogleRed(position));
            gMapControl1.Overlays.Add(overlay);

i also tried with this but doesn't help a lot.

        private void gMapControl1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
            {
                gMapControl1.Zoom--;
            }
            else
            {
                gMapControl1.Zoom++;
            }
            base.OnMouseDoubleClick(e);
        }

Coordinator
Sep 5, 2012 at 11:51 AM

your forget to set Min/Max zooms:

map.MinZoom = ...
map.MaxZoom = ...

Sep 5, 2012 at 11:57 AM

a lot of thanks.

such a stupid mistake