Click here to Skip to main content
13,259,194 members (51,206 online)
Click here to Skip to main content
Add your own
alternative version


55 bookmarked
Posted 14 Aug 2007

a little Virtual Earth Control

, 2 Jun 2008
Rate this:
Please Sign up or sign in to vote.
A small introduction to load Virtual Earth Maps into C#

Screenshot - scr.png


I simply want to realize a User Control to load VEarth Maps into a Windows Form.

The Main problem is that you can load these maps in HTML pages.

So.. i will load in a WebBrowser Control... but a new problem occurs... capture events from HTML pages.


If you use these maps for commercial purposes; read the Microsoft license ($$$$).

To save maps and copy pictures, i use a class from SharpDevelop (Juergen Thomas, Berlin (Germany) -

Using the code

Using this control is very easy.

Create a New Windows Forms Project, then include the DLL as component.

Insert the Control in the form and simply call the method:


There are various method to control the map and the visualisation, I think no explication is needed:

// To Show the initial map 
public void ShowInitialMap()

// and to close the map
public void unInit() 

This methods are to change the map type and to show (or hide) the dashboard, and change it's style.

public enum DashboardStyleEnum  {
public void DashBoardShow()
public void DashBoardHide()
public void DashBoardSet(DashboardStyleEnum dStyle)
public enum MapStyleEnum  {
        Road ,
        Aerial ,
        Hybrid ,
public void SetMapStyle(MapStyleEnum mStyle)

To move in the map and zoom:
All Coordinates are in decimal format.

public void GoToCoordinates(double Latit, double Longit) 
public void SetZoomLevel(Int16 zLevel)
public void ZoomOut()
public void ZoomIn()
public void ZoomWorld()
public void ZoomBest()

To add and remove pushpin on the map:

public void AddPushpin(Int32 IDPush, Double lat, Double lon, String Descrizione)
public void AddPushpin(Int32 IDPush, Double lat, Double lon, String Descrizione, String iconAddress)
public void RemovePushpin(Int32 IDPush)
public void RemoveAllPushpins()

To save the map and print it:

public Bitmap GetMapImage()
public Boolean SaveMapAsBitmap(String FileName)
public Boolean SaveMapAsBitmap()
public void PrintMapDefaultSettings()
public void PrintMapPreview()
public void PrintOptions()

Advanced methods, do not use them if you don't know how you can send as parameter!!!
I declared public to allow everyone send different command directly to the map, based on SDK specification:

public void ExecuteCommandOnMap(String commandText)
public void ExecuteCommandOnMap(String commandText, String commandParameters)
public void ExecuteCommand(String commandText)
public void ExecuteCommand(String commandText, String commandParameters)

The two events; always handle them to avoid a noisy sound when the mouse is on the map:

public class OnMoveOnMapEventArgs : EventArgs
public Double Lat;
public Double Lon;
public DateTime ora;

private void OnClickOnMap(object sender, VEarth.OnClickOnMapEventArgs e)
private void OnMoveOnMap(object sender, VEarth.OnMoveOnMapEventArgs e)

Points of Interest

Virtual Earth SDK:


uh.. first version :p


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Italy Italy
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
SedArash16-Oct-11 5:24
memberSedArash16-Oct-11 5:24 
GeneralExecuteCommand and ExecuteCommandOnMap Pin
jonnesvik26-Aug-10 2:06
memberjonnesvik26-Aug-10 2:06 
GeneralMy vote of 1 Pin
Kerkia4-Mar-09 15:43
memberKerkia4-Mar-09 15:43 
Questioncs_Andr.Controls Pin
Kerkia4-Mar-09 15:41
memberKerkia4-Mar-09 15:41 
GeneralUse with compact framework Pin
Dalli15-Feb-09 8:05
memberDalli15-Feb-09 8:05 
GeneralMouse movement on BirdsEye view Pin
steve gregory20-Jan-09 2:55
membersteve gregory20-Jan-09 2:55 
GeneralNot much use Pin
RichardTrainer5-Aug-08 4:20
memberRichardTrainer5-Aug-08 4:20 
NewsThey uploaded the source. Pin
Alpha Nerd2-Jun-08 10:55
memberAlpha Nerd2-Jun-08 10:55 
GeneralSource for the dll Pin
MetalRob2-Jun-08 0:47
memberMetalRob2-Jun-08 0:47 
GeneralRoutes and Directions Pin
MegaSurfer19-May-08 12:01
memberMegaSurfer19-May-08 12:01 
Generalneed help Pin
Amine barigo8-May-08 15:30
memberAmine barigo8-May-08 15:30 
GeneralWould appreciate source for DLL Pin
cwford0124-Apr-08 5:03
membercwford0124-Apr-08 5:03 
QuestionHow to get the Place name?? Pin
Member 38458158-Apr-08 19:58
memberMember 38458158-Apr-08 19:58 
Generalany news on the source for the DLL Pin
pcummings17-Feb-08 5:20
memberpcummings17-Feb-08 5:20 
QuestionAdding several pushpins Pin
gunnarJonsson4-Dec-07 23:00
membergunnarJonsson4-Dec-07 23:00 
QuestionRe: Adding several pushpins Pin
Member 361493031-Aug-08 19:19
memberMember 361493031-Aug-08 19:19 
GeneralIconAddress Pin
gunnarJonsson29-Nov-07 4:25
membergunnarJonsson29-Nov-07 4:25 
GeneralSources Pin
thaos2K26-Nov-07 7:28
memberthaos2K26-Nov-07 7:28 
GeneralRe: Sources Pin
Andrea_866-Nov-07 7:30
memberAndrea_866-Nov-07 7:30 
GeneralRe: Sources Pin
John Witcher7-Dec-07 10:22
memberJohn Witcher7-Dec-07 10:22 
QuestionSourceCode Pin
michbex11-Nov-07 9:32
membermichbex11-Nov-07 9:32 
QuestionSourcecode to VEarthControl.dll ? Pin
GMEKS14-Aug-07 9:22
memberGMEKS14-Aug-07 9:22 
AnswerRe: Sourcecode to VEarthControl.dll ? Pin
Piascas14-Sep-07 2:24
memberPiascas14-Sep-07 2:24 
GeneralRe: Sourcecode to VEarthControl.dll ? Pin
cnlsmuts17-Nov-07 11:10
membercnlsmuts17-Nov-07 11:10 
GeneralRe: Sourcecode to VEarthControl.dll ? Pin
John Witcher27-Nov-07 18:32
memberJohn Witcher27-Nov-07 18:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 2 Jun 2008
Article Copyright 2007 by Andrea_86
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid