資源簡介
C#中winform開發的地圖定位-Google地圖定位

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Net;
using?System.IO;
using?System.Windows.Forms;
using?System.Runtime.InteropServices;
using?System.xml;
//Download?by?http://www.codefans.net
namespace?Google
{
????public?partial?class?Form1?:?Form
????{
????????[DllImport(“user32.dll“?CharSet?=?CharSet.Auto?SetLastError?=?false)]
????????static?extern?IntPtr?SendMessage(IntPtr?hWnd?uint?Msg?IntPtr?wParam?IntPtr?lParam);
????????[DllImport(“user32.dll“?SetLastError?=?true)]
????????static?extern?IntPtr?GetWindow(IntPtr?hWnd?uint?uCmd);
????????[DllImport(“user32.dll“?CharSet?=?CharSet.Auto)]
????????static?extern?int?GetClassName(IntPtr?hWnd?StringBuilder?lpClassName?int?nMaxCount);
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????this.FormBorderstyle?=?System.Windows.Forms.FormBorderstyle.FixedSingle;
????????????try
????????????{
????????????????//加載地圖
????????????????string?address?=?“File:\\“?+?Application.StartupPath?+?“\\index.html“;
????????????????Uri?url?=?new?Uri(address);
????????????????webBrowser1.Url?=?url;
????????????????webBrowser1.scriptErrorsSuppressed?=?false;
????????????}
????????????catch?(Exception?except)
????????????{
????????????????MessageBox.Show(except.Message?“提示!“
????????????????????MessageBoxButtons.OK?MessageBoxIcon.Warning);
????????????}
????????}
????????private?void?zoombtn1_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????mshtml.IHTMLDocument2?currentDoc?=?(mshtml.IHTMLDocument2)webBrowser1.Document.DomDocument;
????????????????mshtml.IHTMLWindow2?win?=?(mshtml.IHTMLWindow2)currentDoc.parentWindow;
????????????????win.execscript(“ZoomInMap()“?“javascript“);
????????????}
????????????catch?(Exception?except)
????????????{
????????????????MessageBox.Show(except.Message?“提示!“
????????????????????MessageBoxButtons.OK?MessageBoxIcon.Warning);
????????????}
????????}
????????private?void?zoombtn2_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????mshtml.IHTMLDocument2?currentDoc?=?(mshtml.IHTMLDocument2)webBrowser1.Document.DomDocument;
????????????????mshtml.IHTMLWindow2?win?=?(mshtml.IHTMLWindow2)currentDoc.parentWindow;
????????????????win.execscript(“ZoomOutMap()“?“javascript“);
????????????}
????????????catch?(Exception?except)
????????????{
????????????????MessageBox.Show(except.Message?“提示!“
????????????????????MessageBoxButtons.OK?MessageBoxIcon.Warning);
????????????}
????????}
????????public?string?StrAddress?=?““;//記錄用戶輸入的地址。
????????private?void?checkbtn_Click(object?sender?EventArgs?e)
????????{
???????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
???????????????384742????????????????????19
- 上一篇:C# 電話客服系統(完整)
- 下一篇:C# 異或校驗含源碼
評論
共有 條評論