문제

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?

도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top