Tuesday, October 11, 2011

Google Maps in a desktop app

I’ve seen one or two examples of using Google Maps in a WinForms desktop app, but the ones I’ve seen seem to involve loading image tiles from the Google server directly. There’s nothing wrong with that approach but I thought it would be a lot simpler to simply host a local web page using the Google Maps API in a WebBrowser control in an application. Here is a very simple example of this idea.

If you want to extend this example, it’s possible to call scripts in the page via the WebBrowser.Document.InvokeScript method and the application can respond to events in the page via the WebBrowser.ObjectForScripting property.

As an aside, similar ideas can be applied to hosting other Javascript web components, such as an HTML editor like CKEditor.

3 comments:

Unknown said...

thanks sir , It is really helpful to me, can we control map throurh .net controls?. "labeeb.in@gmal.com"

Doogal said...

You're after a .NET control wrapper around the map? Should be possible to write one, but I haven't!

Anonymous said...

You can try GDS Google Map WinForms Control.