| ||||||||||||||||||||
| ||||||||||||||||||||
Note:
This is an unedited contribution. If this article is inappropriate, needs
attention or copies someone else's work without reference then please Report
This Article
IntroductionI 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. BackgroundIf 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) - http://www.codeproject.com/csharp/FormPrintPackage.asp).Using the codeUsing 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:
vEarthControl1.ShowInitialMap();
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 {
Small,
Normal,
Tiny
}
public void DashBoardShow()
public void DashBoardHide()
public void DashBoardSet(DashboardStyleEnum dStyle)
public enum MapStyleEnum {
Road ,
Aerial ,
Hybrid ,
BirdsEye
}
public void SetMapStyle(MapStyleEnum mStyle)
To move in the map and zoom: 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!!! 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 InterestVirtual Earth SDK: http://msdn2.microsoft.com/en-us/library/bb429619.aspx Historyuh.. first version :p Discussions and Feedback16 messages have been posted for this article. Visit http://www.codeproject.com/KB/miscctrl/Virtual_myEarth_Control.aspx to post and view comments on this article, or click here to get a print view with messages.
| ||||||||||||||||||||