GMap.Net does not show full map in the control

风格不统一 提交于 2019-12-11 08:25:36

问题


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.

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?


回答1:


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;


来源:https://stackoverflow.com/questions/11257550/gmap-net-does-not-show-full-map-in-the-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!