1,用Echarts 显示百度地图的用法(2)写一个 baidu.html
2,winform页面放一个WebBrowser控件,用来放地图的html页面
3,winform 加载时 将WebBrowser文件放在baidu.html同一个目录下
webBrw_Map.Url = new Uri(Path.Combine(Application.StartupPath, "baidumap.html"));
4,加载地图
(1),根据经纬度查询
var pointX = "31.035434";
var pointY = "121.248119";
setLocation:html里面根据经纬度查询的方法名
webBrw_Map.Document.InvokeScript("setLocation", new object[] {pointX,pointY});
(2),根据地址查询
var city= "上海";
var address= "中山公园";
setAddress::html里面根据地址查询的方法名
webBrw_Map.Document.InvokeScript("setAddress",new object[] { city, address});
//获取坐标
txt_Longitude.Text = webBrw_Map.Document.GetElementById("lng").InnerText;
txt_Dimensions.Text = webBrw_Map.Document.GetElementById("lat").InnerText;