Creating the most basic Windows Form

Note:  this entry references code for an older version of VE3D.  The newest code samples are here

The samples that can be downloaded below demonstrate creating a basic Windows Application with a VE3D control on it (SimpleForm), however, I wanted to go over the most basic steps.  The sample does not use the Toolbox, but I will.

Step 1: Make sure the VE3D control is installed by visiting http://maps.live.com and switching to 3D. 

Step 2: Select Tools->Choose Toolbox Items... 

Step 3: Make sure GlobeControl is checked in .NET Framework Components tab.  The version should be 2.0.711.13001.  GlobeControl should now show up in your Toolbox under the General section with a gear icon next to it.

Choose Toobox Items dialog

Step 4: Create a new C# Windows Application in Visual Studio 2005.

Step 5: Select GlobeControl from your Toolbox and drop it onto your form.  It should show up with just a big, grey dot in the middle and "GlobeControl" written across it.  This is just the designer view.  If you run the application at this point, you'll see the globe in 3D, but only with the outer most model and if you zoom in you'll just get fuzzy green.  The reason is that we haven't set up any data sources yet, so...

Step 6: Make sure your form is selected (not the GlobeControl) and add a Load event (select the lightening bolt for events in the Properties pane, find Load and double click on it).  Make sure it looks like this:

private

void Form1_Load(object sender, EventArgs e)
{
    this.globeControl1.Host.DataSources.Add(new DataSourceLayerData("Elevation", "Elevation", @"http://maps.live.com//Manifests/HD.xml", DataSourceUsage.ElevationMap));
    this.globeControl1.Host.DataSources.Add(new DataSourceLayerData("Texture", "Texture", @"http://maps.live.com//Manifests/HT.xml", DataSourceUsage.TextureMap));
    this.globeControl1.Host.DataSources.Add(new DataSourceLayerData("Models", "Models", @"http://maps.live.com//Manifests/MO.xml", DataSourceUsage.Model));
}

Step 7: To use the DataSource classes, you'll need to right-click on your project's references and select Add Reference..., select the Browse tab and browse to "C:\Program Files\Virtual Earth 3D".  Select "Microsoft.MapPoint.Data" and "Microsoft.MapPoint.Rendering3D.Utility" and hit OK.

Step 8: Run your application and enjoy!

Definitely look at the samples for more goodness, but these are the basic steps to get started.