views:

533

answers:

3

Is it possible to capture the graphics object created by the Google Earth browser plugin from a .NET WebBrowser control?

With this graphics object I could create an image to use as the background image for a panel that I can then draw on top of.

You cannot just use a WebBrowser control under a Panel control as the Google Earth plugin does not work.

Getting the browser graphics object just returns blank. The browser DrawToBitmap method (no intelisense) returns the web page but without the Google Earth image.

Any ideas?

A: 

My apologies if I misunderstood the question - are you trying to display Google Earth in a Windows Forms program? If so, have a look at Google Earth COM API.

Google Earth COM API

Khadaji
No, that I can do. What I want to be able to do is to get the graphics object to use as the background image for a panel control. The question is quite clear on this.
Stevo3000
Ah well, as I said, my apologies. I wish you luck in your search.
Khadaji
+1  A: 

Take a look at this project of mine: http://code.google.com/p/winforms-geplugin-control-library/ it will go some way to helping. The trick here is to capture the current image from the plugin as a bitmap and then use this (like double buffering).

Especially see the 'ScreenGrabButton_Click' method in 'GEToolStrip.cs' to see how to capture the image.

Fraser
I like your project, but your screen grab relies on the plugin being shown on the screen through a web browser that is visible. I want to be able to get a graphics object/image without having a visible web browser.
Stevo3000
Stevo, you should re-phrase your question then! But AFAIK the answer is no.
Fraser
A: 

After some more research and trial and error I am forced to admit defeat on this one, it seems imposible to show google earth on a panel when the webbrowser control hosing it is offscreen.

The solution is either to live with the limitation:

  • Set the form you wish to draw on background to transparent
  • Create a new form to be the parent of the drawing form
  • Display google earth on the new form
  • Align the forms correctly and allow the child to drive the parent

Or to switch to Microsoft Live Earth as there is already a proof of concept that works for WPF and winforms.

Stevo3000