柚子快报邀请码778899分享:Winform调用百度地图接口

http://yzkb.51969.com/

using System;

using System.IO;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace BaiDuMap

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

try

{

//webBrowser1.Url = new Uri("http://www.2345.com");

//这个文件于可执行文件放在同一目录

webBrowser1.Url = new Uri(Path.Combine(Application.StartupPath, "GoogleMap.htm"));

}

catch (Exception ex)

{

MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)

{

//这里传入x、y的值,调用JavaScript脚本

webBrowser1.Document.InvokeScript("setLocation", new object[] { 121.504, 39.212 });

}

}

}

////////////////////////////////////////////////////////////////////////////////////////////////

百度地图的Hello World

描述:一个html文件调用了百度地图接口,一个winform程序调用该网页显示地图

柚子快报邀请码778899分享:Winform调用百度地图接口

http://yzkb.51969.com/

相关阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。