PDA

View Full Version : Context menu disabled and Arrow of direction still actived ?



noreli
11-21-2006, 03:08 PM
I succeeded in disabling the right context menu (BeforeClick and e.cancel=true), but, then, it's not possible any more to use the Arrow (The on which are roll over on map's border and which enable move on map).

I have an idea on how to do it : I analyse the position of mouse. and I e.cancel only when X,Y are on border's map. But that's a bit dirty and what if the map is reduced with a sub window (like the directions subscreen) ?

Any one, has an idea ?

PS : I use C#, VS2005

noreli
11-21-2006, 04:08 PM
I found the answer by myself...
I just have to check in the event.button property if the right button is click. The value for Right button is 2.

The code of the handler is :




private void axMappointControl1_BeforeClick(object sender, AxMapPoint._IMappointCtrlEvents_BeforeClickEvent e)
{
if (e.button == 2)
{
e.cancel = true;
}
}
Don't forget to declare the event handler in the form constructor :



public Form1()
{
InitializeComponent();
axMappointControl1.NewMap(MapPoint.GeoMapRegion.ge oMapEurope);

axMappointControl1.BeforeClick += new AxMapPoint._IMappointCtrlEvents_BeforeClickEventHa ndler(axMappointControl1_BeforeClick);
}
}

[/code]