• 大小: 0.22M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: C#
  • 标签: 其他  

资源简介

[best]MapWinForms.rar

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

//新添加命名空间  
using System.Net;
using System.IO;
using System.Security.Permissions;  //交互JS

namespace MapWinForms
{
    [PermissionSet(SecurityAction.Demand Name = “FullTrust“)]
    [System.Runtime.InteropServices.ComVisibleAttribute(true)]

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //载入加载地图
        private void Form1_Load(object sender EventArgs e)
        {
            //本地文件 MapWinForms\bin\Debug
            string url = Application.StartupPath + “\\BaiMapJS.html“;
            string file = “file:///E:\\WinFormBaiduMap\\test.html“;

            webBrowser1.scriptErrorsSuppressed = true;   //屏蔽js相关错误
            webBrowser1.Navigate(url);                   //导航显示本地HTML文件
        }

        //城市搜索
        private void button1_Click(object sender EventArgs e)
        {
            /**
                * 参考资料:
                * http://bbs.csdn.net/topics/390935011
                * http://www.sufeinet.com/thread-7897-1-1.html
                */

            //C#调用JS函数
            string city;
            if (comboBox1.SelectedIndex == -1)
            {
                city = “北京“;
            }
            else 
            {
                city = comboBox1.SelectedItem.ToString();
            }
            webBrowser1.Document.Invokescript(“LoadMap“ new object[] { city });
        }

        //车间搜索
        private void button2_Click(object sender EventArgs e)
        {
            string city;
            if (comboBox1.SelectedIndex == -1)
            {
                city = “北京“;
            }
            else
            {
                city = comboBox1.SelectedItem.ToString();
            }
            webBrowser1.Document.Invokescript(“SearchCarMap“ new object[] { city });
        }

        //附近热点搜索
        private void button3_Click(object sender EventArgs e)
        {
            string city;
            if (comboBox1.SelectedIndex == -1)
            {
                city = “北京“;
            }
            else
            {
                city = comboBox1.SelectedItem.ToString();
            }
            string key;
            if (comboBox2.SelectedIndex == -1)
            {
                key = “学校“;
            }
            else
            {
                key = comboBox2.SelectedItem.ToString();
            }
            webBrowser1.Document.Invokescript(“SearchNearbyMap“ new object[] { city key });
        }

        //当前位置定位
        private void button4_Click(object sender EventArgs e)
        {
            webBrowser1.Document.Invokescript(“LocateMyPlcae“ new object[] { });
        }

        //附近餐馆
        pri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        187  2016-05-15 01:17  [best] MapWinForms\MapWinForms\App.config

     文件       9650  2016-05-19 00:08  [best] MapWinForms\MapWinForms\bin\Debug\BaiMapJS.html

     文件       1230  2016-05-18 23:14  [best] MapWinForms\MapWinForms\bin\Debug\BaiMapJS2.html

     文件      12800  2016-05-19 00:00  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.exe

     文件        187  2016-05-15 01:17  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.exe.config

     文件      32256  2016-05-19 00:00  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.pdb

     文件      22984  2016-05-19 02:01  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.vshost.exe

     文件        187  2016-05-15 01:17  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.vshost.exe.config

     文件        490  2013-06-18 20:28  [best] MapWinForms\MapWinForms\bin\Debug\MapWinForms.vshost.exe.manifest

     文件       3511  2016-05-19 00:00  [best] MapWinForms\MapWinForms\Form1.cs

     文件      10954  2016-05-18 23:16  [best] MapWinForms\MapWinForms\Form1.Designer.cs

     文件       5817  2016-05-18 23:16  [best] MapWinForms\MapWinForms\Form1.resx

     文件       3801  2016-05-15 01:20  [best] MapWinForms\MapWinForms\MapWinForms.csproj

     文件       1308  2016-05-18 13:03  [best] MapWinForms\MapWinForms\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7015  2016-05-17 02:44  [best] MapWinForms\MapWinForms\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1416  2016-05-19 02:01  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.csproj.FileListAbsolute.txt

     文件        975  2016-05-18 23:16  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.csproj.GenerateResource.Cache

     文件       2209  2016-05-15 01:20  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.csprojResolveAssemblyReference.cache

     文件      12800  2016-05-19 00:00  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.exe

     文件        180  2016-05-18 23:16  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.Form1.resources

     文件      32256  2016-05-19 00:00  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.pdb

     文件        180  2016-05-15 01:20  [best] MapWinForms\MapWinForms\obj\Debug\MapWinForms.Properties.Resources.resources

     文件          0  2016-05-15 01:17  [best] MapWinForms\MapWinForms\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2016-05-15 01:17  [best] MapWinForms\MapWinForms\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2016-05-15 01:17  [best] MapWinForms\MapWinForms\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        523  2016-05-15 01:17  [best] MapWinForms\MapWinForms\Program.cs

     文件       1342  2016-05-15 01:17  [best] MapWinForms\MapWinForms\Properties\AssemblyInfo.cs

     文件       2874  2016-05-15 01:17  [best] MapWinForms\MapWinForms\Properties\Resources.Designer.cs

     文件       5612  2016-05-15 01:17  [best] MapWinForms\MapWinForms\Properties\Resources.resx

     文件       1098  2016-05-15 01:17  [best] MapWinForms\MapWinForms\Properties\Settings.Designer.cs

............此处省略15个文件信息

评论

共有 条评论