Question

I am trying to make a small application which has the capability of showing maps. I came across GMap.Net which is great for my purpose except for the fact that the map does not show completely in the control. I am attaching a picture and hope you can understand my problem.

enter image description here My code of the load button is

private void button_Load_Click(object sender, EventArgs e)
        {
            MapControl.SetCurrentPositionByKeywords("Pakistan");
            MapControl.MapProvider = GMapProviders.BingHybridMap;
            MapControl.MinZoom = 3;
            MapControl.MaxZoom = 17;
            MapControl.Zoom = 5;
            MapControl.Manager.Mode = AccessMode.ServerOnly;

            GMapProvider.WebProxy = null;
            MapControl.Position = new PointLatLng(31.5758, 74.3269);

            GMapOverlay OverlayOne = new GMapOverlay(MapControl, "OverlayOne");

            OverlayOne.Markers.Add(new GMapMarkerGoogleRed(new PointLatLng(31.5758, 74.3269)));

            MapControl.Overlays.Add(OverlayOne);
        }

The other button is not implemented as are the text boxes. I Googled the problem a lot but was not able to find a solution, so my question is, is there a way to fill the mapcontrol area with map?

Was it helpful?

Solution

You would like to set client Size.This takes size of control and assigns to client to be rendered

Size siz = new System.Drawing.Size(MapControl.Width,MapControl.Height);
MapControl.ClientSize = siz;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top