Embed Google Maps in C# Application

First check out this post to see how you can retreive the GPS location of your device.

Then you can use following code to display the map in your windows form

String locationString = @"http://maps.google.com/maps/api/staticmap?center=" + lat.ToString() + "," + lon.ToString() + "&zoom=14&size=250x250&maptype=roadmap&markers=color:red%7Clabel:S%7C" + lat.ToString() + "," + lon.ToString() + "&sensor=false";
            TaxiLocation loc = new TaxiLocation();
            webBrowser1.Url = new Uri(@"d:myMap.html");

Taxi Location Class

    class TaxiLocation

        public void WriteHtml(String Maps)
            string htmlDocument = @"";
            FileStream fs = File.OpenWrite(@"d:myMap.html");
            StreamWriter writer = new StreamWriter(fs, Encoding.UTF8);


Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.

Leave a Reply