Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Custom context menu within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm asking here after searching this forum and googling for hours - I thought I'd find an answer but no ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Custom context menu Using the ActiveX control and .NET. All I'd like to do is create my own context menu when the user right-clicks a pushpin. I can trap when the right mouse button is clicked, but I can't seem to figure out how to get the pushpin object (or even just the Name property) from the user's click. You can get the x,y coordinates of the click event, but how do I find a pushpin from that? Thanks, Mike |
| |||
|
Funny how you can search differently after you post a question. This seems to get the name ok, which I can work with, would still be open to suggestions. Code: private void axMap_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
MapPoint.Pushpin pushPin = (MapPoint.Pushpin)e.pNewSelection;
MessageBox.Show(pushPin.Name);
}
|
| |||
|
FWIW, this is what I'm doing so far, but really, I'm not sure of the best way. I just need to put together some demo/proof of concept real quick. Code: private void axMap_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
MapPoint.Pushpin pushPin = (MapPoint.Pushpin)e.pNewSelection;
if (pushPin == null)
{
// I guess other objects besides pushpins can get selected.
//MessageBox.Show("pushPin is null");
}
else
{
ContextMenu cm = new ContextMenu();
cm.MenuItems.Add("Do something with " + pushPin.Name); // To do: Wire the event handlers.
cm.Show(axMap, new Point(42, 42)); // Figure out how to position.
//MessageBox.Show(pushPin.Name);
}
}
Mike |
![]() |
| Tags |
| context, custom, menu |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disable Context menu | Anonymous | MapPoint 2006/2009 Discussion | 12 | 12-23-2008 12:05 PM |
| Click events of context menu are not firing.... | Learner | MapPoint 2006/2009 Discussion | 6 | 05-12-2008 02:33 PM |
| By Right-click displaying context menu on map | Banu | MapPoint 2006/2009 Discussion | 19 | 10-16-2007 07:46 AM |
| Extending MapPoint - How about the Context Menu Enhancements | Anonymous | MapPoint 2006/2009 Discussion | 2 | 02-10-2004 09:38 AM |
| VB.NET & overriding the map point context menu... | Anonymous | MapPoint 2006/2009 Discussion | 0 | 09-05-2002 08:25 AM |
Bodrum Holiday
Check out the picturesque towns on your Bodrum holiday... Book through UlookUbook!