首先在C#中新建windows 应用程序。然后再form1中新建panel控件。命名为pnlEarth。
然后双击form1,进入form1.cs.
1、以下是代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EARTHLib;
using System.Runtime.InteropServices;
using HookAPI;
using System.Threading;
namespace MYGPS3
{
public partial class Form1 : Form
{
private IntPtr _GEHrender;
private IntPtr _GEParentHrender;
private IntPtr _GEMainHandler;
private IApplicationGE _googleEarth;
private System.Windows.Forms.Control _parentControl;
IntPtr mapPtr;
IntPtr mainPtr;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SetGEHandlerToControl(pnlEarth, _googleEarth);
}
/// <summary>
/// 将GE的地图控件挂载到指定的控件中去
/// </summary>
/// <param name="parentControl">c#控件</param>
/// <param name="geApplication">ge应用程序</param>
publi