Display Google Map in Windows Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ucu13
    New Member
    • May 2012
    • 14

    Display Google Map in Windows Form

    I have to display google maps in a windows form.
    I managed to display the map in the form like this link:


    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?
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    #2
    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.

    Comment

    • ucu13
      New Member
      • May 2012
      • 14

      #3
      Code:
       public partial class GoogleMap : Form
          {
              MeasuringPointDetail measuringPointDetail = new MeasuringPointDetail();
              public string Lat = "";
              public string Long = "";
              public GoogleMap()
              {
                  InitializeComponent();
              }
      
              private void GoogleMap_Load(object sender, EventArgs e)
              {
                  if (Lat == string.Empty || Long == string.Empty)
                  {
                      this.Dispose();
                  }
      
                  try
                  {
                      StringBuilder queryAddress = new StringBuilder();
                      queryAddress.Append("http://maps.google.com/maps?q=");
      
                      if (Lat != string.Empty)
                      {
                          queryAddress.Append(Lat + "%2C");
                      }
      
                      if (Long != string.Empty)
                      {
                          queryAddress.Append(Long);
                      }
      
                      webBrowser1.Navigate(queryAddress.ToString());
                  }
                  catch (Exception ex)
                  {
                      MessageBox.Show(ex.Message.ToString(), "Error");
                  }
              }
          }

      Comment

      • madankarmukta
        Contributor
        • Apr 2008
        • 308

        #4
        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.



        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.

        Comment

        Working...