A pushpin in MapPoint is represented by the Pushpin class. The Name property of a Pushpin object can be used to annotate the Pushpin. You can also add notes to the Pushpin using the Pushpin.Notes property.

A Pushpin is essentially symbol (icon) on the map; MapPoint provides a number of symbols to be used with Pushpins. These symbols are indexed and their number should be used to indicate the symbol of a given Pushpin; For example the default symbol is black pushpin represented by the number 0. The valid range for the standard symbols is 0-255.

To add a pushpin to a location, you just have to call the Map.AddPushpin method, as shown below:

//Get map center location
MapPoint.Location location = axMappointControl1.ActiveMap.Location;
//Add a pushpin at this location
MapPoint.Pushpin pushpin = axMappointControl1.ActiveMap.AddPushpin(
location, "Center");
//Assign a symbol
pushpin.Symbol = 64;
//Select and highlight the location
pushpin.Select();
pushpin.Highlight = true;
//Write annotation
pushpin.Note = "This is my favorite place!";

Now if you want to open the “info window” for the pushpin, you can use the Pushpin.BallonState enumeration.

To learn more about this topic and other related topics, please buy Programming MapPoint in .NET

0 comments