Community of VE/MapPoint Users and Developers
This is a discussion on How to make shapes unmoveable ? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, As shapes that are programmatically added can be moved by the user with the mouse, I wonder if it ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| How to make shapes unmoveable ? Do you know if that is possible and how ? (without having to copy/paste the map on a picturebox |
| |||
|
Hi, Yes it sure is possible. On this forum you find an article how to make pushpins inmoveable. Same trick could be used for shapes I suppose. http://www.mp2kmag.com/a97--pushpins....mappoint.html Check also what has been discussed here: http://www.mp2kmag.com/mappoint/disc...pic.asp?t=4315
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Thanks. I've taken a look at these threads and they are interesting. In order to prevent the user from moving pushpins and shapes I've tried the following code but I alway get a "Stack Overflow" error from the C# runtime : Code: private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
// I don't cast anything here because I consider any selection to be a shape or pushpin
MapPoint.Shape sp;
MapPoint.Location loc;
try
{
loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
sp.Select();
sp.Delete();
}
catch(Exception)
{
}
}
the error is : An unhandled exception of type 'System.StackOverflowException' occurred in axinterop.mappoint.dll |
| |||
|
Hi, Code: sp.Select(); You have to set a busy flag on entering the function an first check if it is true, if true then exit. When the function exit you set the flag again to false. Do not put the flag on the stack. something like this will do: Code: if (!select_change_busy) {
select_change_busy = true;
// here the code
select_change_busy = false;
}
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Great !!!! Thank you mister Wilfried !!! Let's share this wonderful tip Code: bool select_change_busy = false;
private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
if (!select_change_busy)
{
select_change_busy=true;
MapPoint.Shape sp;
MapPoint.Location loc;
try
{
loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
sp.Select();
sp.Delete();
}
catch(Exception)
{
}
select_change_busy=false;
}
}
|
| |||
|
Hi Jaba, Thanks for the feedback. Doing so other can benefit from it also Tip: You can put code between tags, then it is nice formatted and ident
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi Wilfried... You're welcome Now I want to deactivate the moving of shapes only, because with the source code above this also deactivates the viewing of pushpins' labels I've tried the following to deactivate the moving of shapes only but I can't understand why it does not work as I would like it to ? Code:
bool select_change_busy = false;
private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
if (!select_change_busy)
{
select_change_busy=true;
MapPoint.Shape sp;
MapPoint.Location loc;
MapPoint.Shape sp2;
try
{
sp2 = (MapPoint.Shape) e.pNewSelection;
loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
sp.Select();
sp.Delete();
sp2=null;
}
catch(Exception)
{
}
select_change_busy=false;
}
}
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Make shorter a GeoBalloonState | clavijo | MapPoint 2006/2009 Discussion | 2 | 08-03-2004 01:31 AM |
| $$$ Will Pay for A Way to Make a Map $$$ | webdbx | MapPoint 2006/2009 Discussion | 4 | 07-28-2004 07:38 AM |
| How to make invisible a pushpin | clavijo | MapPoint 2006/2009 Discussion | 2 | 07-09-2004 06:41 AM |
| Make New own baseMap | Anonymous | MapPoint 2006/2009 Discussion | 1 | 12-03-2003 09:02 AM |
| trying to make a 'locator map' | Anonymous | MapPoint 2006/2009 Discussion | 0 | 04-09-2003 03:37 PM |
Skiing in France
Skiing in France is varies hugely from place to place and is suitable for all skiers. Using a range of leading tour operators, Holiday Hypermarket can help you find cheap holidays.
European City Breaks
Book European city breaks with Travel Counsellors. A personal travel counselor will help plan your European city break.
Cheap Flight Canada
Making a cheap flight to Canada can become a reality when you book online with dealchecker.co.uk. Our simple search allows you to see for yourself who is the cheapest.
Maldives Holidays
If you are looking for a serene, laid back break in the sunshine, Maldives holidays are the choice for you. Be enchanted by the Maldives!
Cheap Canaries Holidays
Are you hunting down cheap Canaries holidays? Well check out ulookubook.com to bag a great value holiday. There are numerous festivals taking place all year round. Why not book your holiday around one?
Cheap Inclusive
Make use of our service at Travel.co.uk to help you to research cheap inclusive holidays.
Cheap Holidays in Portugal
Don't spend your hard earned money on travelling agents! Come to On The Beach, and see information on cheap holidays in Portugal.