GMap.Net does not show full map in the control
Asked Answered
P

1

2

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?

Patent answered 29/6, 2012 at 7:10 Comment(1)
Doesn't the map have a Width and Height, or stretch property ?Hamon
D
3

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;
Dejected answered 29/6, 2012 at 7:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.