Expecho's .Net corner
All about software development

How to use the virtual earth winforms user control part 4: Mouse events, images and layers

June 26, 2008 15:54 by Peter Bons

Using layers 

It is possible to add pushpins to layers like this:

ucVEarth.VE_AddShapeLayer("Test", "Test");
   
    SearchLocation loc = new SearchLocation();
    loc.Latitude = latitude;
    loc.Longitude = longitude;
    loc.PushPinTitle = "You've put me on the map";
    loc.PushPinLayer = "Test"; // add the pushpin to the layer "Test"
    ucVEarth.VE_AddPushPin(l);

    ucVEarth.VE_SetShapeLayerVisible("Test", false) // hide all pushpins in layer "Test"

    ucVEarth.VE_DeleteShapeLayer("Test");

 

Save an image of the map

To save an image of the map to disk use the VE_SaveMapImage() method:

ucVEarth.VE_SaveMapImage(System.Drawing.Imaging.ImageFormat.Jpeg, @"c:\mapimage.jpg");

Handle mouse events

The following events are supported:

Example:

void ucVEarth_VE_OnMouseClick(double latitude, double longitude, object id, bool altKey, bool ctrlKey, bool shiftKey, bool leftButton, bool rightButton)
    {
        SearchLocation loc = new SearchLocation();
        loc.Latitude = latitude;
        loc.Longitude = longitude;
        loc.PushPinDescription = String.Format("Lat: {0}, Long: {1}", latitude, longitude); 
        loc.PushPinTitle = "You've put me on the map";
        ucVEarth.VE_AddPushPin(loc); 
    }


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

July 4. 2009 18:21