GMap.NET 1.6版本的查找功能

童话少年 2012-01-18 08:45:06
GMap.NET 1.6版本的查找功能要怎么显示啊?
有知道的解答下好么
...全文
86 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
觉悟之时 2012-02-21
  • 打赏
  • 举报
回复
//根据城市查询地图。
private void btnSearch_Click(object sender, EventArgs e)
{
if (this.txtAddress.Text.Length == 0)
{
this.txtAddress.Focus();
MessageBox.Show("请输入查询的地址");
}

//GMapControl MainMap = new GMapControl();
//GeoCoderStatusCode code = MainMap.SetCurrentPositionByKeywords(txtAddress.Text);

//string search = string.Format("{0}", this.txtAddress.Text);
//GeoCoderStatusCode code = this.gMapControl1.SetCurrentPositionByKeywords(search);
GeoCoderStatusCode code = MainMap.SetCurrentPositionByKeywords(txtAddress.Text);

if (code != GeoCoderStatusCode.G_GEO_SUCCESS)
{
MessageBox.Show("地址没有找到:'" + this.txtAddress.Text + "', 原因:" + code.ToString(), "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}

objects = new GMapOverlay(this.gMapControl1, "objects");
objects.Markers.Clear();

AddLocation(this.txtAddress.Text);
}

private void AddLocation(string place)
{
GeoCoderStatusCode unknow = GeoCoderStatusCode.Unknow;
GMapControl MainMap = new GMapControl();
PointLatLng? latLngFromGeocoder = GMap.NET.MapProviders.GMapProviders.GoogleChinaMap.GetPoint(place, out unknow);
//PointLatLng? latLngFromGeocoder = Singleton<GMaps>.Instance.GetLatLngFromGeocoder(place, out unknow);
if (latLngFromGeocoder.HasValue && (unknow == GeoCoderStatusCode.G_GEO_SUCCESS))
{
GMapMarker item = new GMapMarkerGoogleGreen(latLngFromGeocoder.Value);
GMapMarkerRect rect = new GMapMarkerRect(latLngFromGeocoder.Value);
rect.Size = new System.Drawing.Size(100, 100);
rect.ToolTipText = place;
rect.ToolTipMode = MarkerTooltipMode.Always;

objects = new GMapOverlay(this.gMapControl1, "objects");
objects.Markers.Add(item);
objects.Markers.Add(rect);
}
}
童话少年 2012-01-18
  • 打赏
  • 举报
回复
有高手解答么,网上找的解决办法都是以前版本的,现在都用不了了
童话少年 2012-01-18
  • 打赏
  • 举报
回复
在顶上,等高手来解答下

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧