资源简介

C#开发调用百度地图可定位城市

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Collections;

namespace BaiduMap
{
    public partial class Form1 : DevComponents.DotNetBar.Office2007Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonX1_Click(object sender EventArgs e)
        {
            Map();
        }
        DataTable dt = new DataTable();
        public void Map()
        {
            try
            {
                string city = this.comboBoxEx1.Text;
                if (city == ““)
                {
                    MessageBox.Show(“请选择城市“);
                    return;
                }

                DataRow[] myDataRow = dt.Select(“城市=‘“+city+“‘“);
                DataTable myNewDt = dt.Clone();
                for (int i = 0; i < myDataRow.Length; i++)
                {
                    myNewDt.ImportRow(myDataRow[i]);
                }
                if (myNewDt.Rows.Count != 0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(“\n“);
                    sb.Append(“lns=\“http://www.w3.org/1999/xhtml\“>\n“);
                    sb.Append(“\n“);
                    sb.Append(“ta http-equiv=\“Content-Type\“ content=\“text/html; charset=gb2312\“ />\n“);
                    sb.Append(“ta name=\“keywords\“ content=\“百度地图百度地图API,百度地图自定义工具,百度地图所见即所得工具\“ />\n“);
                    sb.Append(“ta name=\“description\“ content=\“百度地图API自定义地图,帮助用户在可视化操作下生成百度地图\“ />\n“);
                    sb.Append(“tle>百度地图API自定义地图tle>\n“);
                    sb.Append(“\n“);
                    sb.Append(“yle type=\“text/css\“>\n“);
                    sb.Append(“    htmlbody{margin:0;padding:0;}\n“);
                    sb.Append(“    .iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap}\n“);
                    sb.Append(“    .iw_poi_content {font:12px arialsans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word}\n“);
                    sb.Append(“
yle>\n“);
                    sb.Append(“ript type=\“text/javascript\“ src=\“http://api.map.baidu.com/api?key=&v=1.1&services=true\“>ript>\n“);
                    sb.Append(“\n“);
                    sb.Append(“\n“);
                    sb.Append(“\n“);
                    sb.Append(“yle=\“width:“ + (this.webBrowser1.Width - 28) + “px;height:“ + (this.webBrowser1.Height - 28) + “px;border:#ccc solid 1px;\“ id=\“dituContent\“>
“);
                    sb.Append(“\n“);
             

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-01-17 14:37  BaiduMap\
     目录           0  2013-09-28 17:21  BaiduMap\BaiduMap\
     文件        4552  2013-09-28 17:26  BaiduMap\BaiduMap\BaiduMap.csproj
     文件         227  2013-01-17 15:04  BaiduMap\BaiduMap\BaiduMap.csproj.user
     文件       10362  2013-01-17 16:38  BaiduMap\BaiduMap\BaiduMap_cityCenter.txt
     文件        4092  2013-01-17 16:00  BaiduMap\BaiduMap\BaiduMap_cityCode.txt
     文件        6288  2013-01-17 16:44  BaiduMap\BaiduMap\Form1.Designer.cs
     文件       13129  2013-01-17 17:22  BaiduMap\BaiduMap\Form1.cs
     文件      107589  2013-01-17 16:44  BaiduMap\BaiduMap\Form1.resx
     文件        6520  2013-09-28 17:23  BaiduMap\BaiduMap\Form2.Designer.cs
     文件         399  2013-09-28 17:25  BaiduMap\BaiduMap\Form2.cs
     文件       12034  2013-09-28 17:23  BaiduMap\BaiduMap\Form2.resx
     文件         469  2013-01-17 14:37  BaiduMap\BaiduMap\Program.cs
     目录           0  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\
     文件        1358  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\AssemblyInfo.cs
     文件        2864  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\Resources.Designer.cs
     文件        5612  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\Resources.resx
     文件        1091  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\Settings.Designer.cs
     文件         249  2013-01-17 14:37  BaiduMap\BaiduMap\Properties\Settings.settings
     文件        4287  2013-01-17 15:18  BaiduMap\BaiduMap\TextFile1.html
     文件        3989  2013-01-17 16:13  BaiduMap\BaiduMap\TxtFileEncoding.cs
     目录           0  2013-01-17 16:23  BaiduMap\BaiduMap\bin\
     目录           0  2018-05-04 09:17  BaiduMap\BaiduMap\bin\Debug\
     文件       10362  2013-01-17 16:39  BaiduMap\BaiduMap\bin\Debug\BaiduMap_cityCenter.dat
     文件        4092  2013-01-17 16:07  BaiduMap\BaiduMap\bin\Debug\BaiduMap_cityCode.dat
     文件      192512  2013-09-28 17:17  BaiduMap\BaiduMap\bin\Debug\MonthCalendar.dll
     文件         866  2013-01-17 14:37  BaiduMap\BaiduMap.sln
     文件        4064  2013-01-17 16:58  BaiduMap\BaiduMap\bin\Debug\map2.html
     文件      158720  2013-01-17 17:22  BaiduMap\BaiduMap\bin\Debug\百度地图.exe
     文件       28160  2013-01-17 17:22  BaiduMap\BaiduMap\bin\Debug\百度地图.pdb
     文件       11608  2013-09-28 17:16  BaiduMap\BaiduMap\bin\Debug\百度地图.vshost.exe
............此处省略25个文件信息

评论

共有 条评论