PC-Side Map Hybird application development (Baidu map Api+c#+javascript) __java

Source: Internet
Author: User

After a outsourcing, let me do the map system. Using C # nested JavaScript programming for Hybird applications, framework memory is based on WinForm, invoking control Webbrowser,webbrowser interpretation, rendering HTML files, JavaScript scripts. Map using the Baidu Map API, through the HTTP encryption AK request, to obtain the real basic map, positioning points according to the location of the coordinates, the dynamic effect is the use of JavaScript to complete. JavaScript link SQL Server

GitHub Source: Https://github.com/QQ951127336/Hybird_map 1.vs new WinForm Project

Form.designer.cs, tune a WebBrowser control

Namespace Map {Partial class Map {///<summary>///Required Designer.

        </summary> private System.ComponentModel.IContainer components = null;
        <summary>///clean up any being used. </summary>///<param name= "disposing" >true if managed resources should is disposed; Otherwise, false.</param> protected override void Dispose (bool disposing) {if (dispos ing && (components!= null)) {components.

            Dispose (); Base.
        Dispose (disposing); #region Windows Form Designer generated code///<summary>///Required method for Desig
        NER support-do not modify///the contents of this method with the Code editor. </summary> private void InitializeComponent () {this.webbrowser1 =New System.Windows.Forms.WebBrowser (); This.
            SuspendLayout ();
            WebBrowser1//this.webBrowser1.Location = new System.Drawing.Point (0, 0);
            This.webBrowser1.MinimumSize = new System.Drawing.Size (20, 20);
            This.webBrowser1.Name = "WebBrowser1";
            This.webBrowser1.Size = new System.Drawing.Size (1474, 1229);
            This.webBrowser1.TabIndex = 0; this.webBrowser1.DocumentCompleted + = new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler (
            this.webbrowser1_documentcompleted); Map//this.
            Autoscaledimensions = new System.Drawing.SizeF (10F, 20F); This.
            AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; This.
            ClientSize = new System.Drawing.Size (1500, 1400); This.
            Controls.Add (This.webbrowser1); This.
            Name = "Map"; This.
            Text = "Huqiu District Bank Inquiry System"; This.Load + = new System.EventHandler (this. Huqiu District Bank Inquiry system _load); This.

        ResumeLayout (FALSE);

    #endregion private System.Windows.Forms.WebBrowser WebBrowser1; }
}
the 2.webbrowser Navigate method imports the HTML file path, and then you can start writing content in JS.
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;

Namespace map
{public
    partial class Map:form
    {public
        map ()
        {
            InitializeComponent ();
            string path = System.Environment.CurrentDirectory;

            This.webBrowser1.Navigate (path+ "\\map.html");
        }

        private void Webbrowser1_documentcompleted (object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }

        private void Huqiu District Bank query system _load (object sender, EventArgs e)
        {

        }
    }
}
3. Create HTML framework and apply for Baidu AK

AK Application Address:
Http://lbsyun.baidu.com/apiconsole/key
HTML file

<! DOCTYPE html>  

This is roughly done a map, and then is the Baidu map of the Jsapi page Jump

window.location.href= ' map.html ';/quotes inside the file to enter the jump
a SQL Server database connection was added

Conn. Open ("Provider=SQLOLEDB.1;Data source=127.0.0.1,1433; User Id=sa; Password=school1234567890;initial Catalog=highschool ");
Provider is the driver, data source is the address and port, then the user and password, and the database name.
Manipulate the database through Execute ("database statement").

    function Conndb () {conn = new ActiveXObject ("ADODB.
        Connection "); Conn. Open ("Provider=SQLOLEDB.1;Data source=127.0.0.1,1433; User Id=sa;
        Password=school1234567890;initial Catalog=highschool "); var x_sql = conn.
        Execute ("Select X from Bank"); var y_sql = conn.
        Execute ("Select y from bank"); var name_sql = conn.
        Execute ("Select name from Bank"); var local_sql = conn.
        Execute ("Select Local from Bank"); var phone_sql = conn.
        Execute ("Select phone from bank"); var img_sql = conn.
        Execute ("Select image from Bank;"); if (time<x_sql. Fields.Count) time = X_sql.

        Fields.Count;
        var i = 0; while (!x_sql. EOF) {Banks[bank_amount] = new Bank (x_sql. Fields (i). Value,y_sql. Fields (i). Value,name_sql. Fields (i). Value,local_sql. Fields (i). Value,phone_sql. Fields (i). Value,img_sql.
        Fields (i). value);
        X_sql.movenext ();
        Y_sql.movenext ();
        Name_sql.movenext (); Local_sql.movenext ();
        Phone_sql.movenext ();

        Img_sql.movenext ();
        bank_amount++; } 



    }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.