GMap.Net在控件中不显示完整地图 [英] GMap.Net does not show full map in the control

查看:322
本文介绍了GMap.Net在控件中不显示完整地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个具有显示地图功能的小型应用程序.我遇到了GMap.Net,这对于我的目的非常有用,除了地图未完全显示在控件中的事实之外.我附上图片,希望您能理解我的问题.

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);
        }

另一个按钮未实现,文本框也未实现.我用Google搜索了很多问题,但是找不到解决方案,所以我的问题是,有没有办法用地图填充mapcontrol区域?

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?

推荐答案

您要设置client Size.这需要控制大小并分配给要呈现的客户端

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;

这篇关于GMap.Net在控件中不显示完整地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆