By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,972 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,972 IT Pros & Developers. It's quick & easy.

Display Google Map in Windows Form

P: 14
I have to display google maps in a windows form.
I managed to display the map in the form like this link:
http://maps.google.ro/maps?q=N45.447...53418&t=m&z=16

but i have to display only the frame with the map in the form..not the whole page.
can someone give me an idea or a piece of code?
Jun 1 '12 #1
Share this Question
Share on Google+
3 Replies


100+
P: 293
Could you please put in your current code snippet for displaying the Map on the form.

Perhaps, this may help to resolve your problem ASAP.
Jun 1 '12 #2

P: 14
Expand|Select|Wrap|Line Numbers
  1.  public partial class GoogleMap : Form
  2.     {
  3.         MeasuringPointDetail measuringPointDetail = new MeasuringPointDetail();
  4.         public string Lat = "";
  5.         public string Long = "";
  6.         public GoogleMap()
  7.         {
  8.             InitializeComponent();
  9.         }
  10.  
  11.         private void GoogleMap_Load(object sender, EventArgs e)
  12.         {
  13.             if (Lat == string.Empty || Long == string.Empty)
  14.             {
  15.                 this.Dispose();
  16.             }
  17.  
  18.             try
  19.             {
  20.                 StringBuilder queryAddress = new StringBuilder();
  21.                 queryAddress.Append("http://maps.google.com/maps?q=");
  22.  
  23.                 if (Lat != string.Empty)
  24.                 {
  25.                     queryAddress.Append(Lat + "%2C");
  26.                 }
  27.  
  28.                 if (Long != string.Empty)
  29.                 {
  30.                     queryAddress.Append(Long);
  31.                 }
  32.  
  33.                 webBrowser1.Navigate(queryAddress.ToString());
  34.             }
  35.             catch (Exception ex)
  36.             {
  37.                 MessageBox.Show(ex.Message.ToString(), "Error");
  38.             }
  39.         }
  40.     }
Jun 1 '12 #3

100+
P: 293
Hi,

Not really aware of how to display the Map which is restricted to the Frame dimentions in Winform.

But, yeah here is the optional way you can look at. Please follow the link.

http://gglgeo.codeplex.com/wikipage?...Form%20Control

The sample reveals the use of Satic Google Maps Winform control.The set to the Height and width would refrain the Map getting display throughout the page.
Jun 4 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.