MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Answer: How to show mappoint toolbars with C#

This is a discussion on Answer: How to show mappoint toolbars with C# within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I've spent a lot of time google searching for this answer without any luck (even browsing past messages here), but ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Answer: How to show mappoint toolbars with C#

I've spent a lot of time google searching for this answer without any luck (even browsing past messages here), but I finally figured out how to do it.

assuming axMappointControl is your control, and you want to show the navigation bar, then use this code:

Code:
object barObj = "navigation";
this.axMappointControl.Toolbars.get_Item(ref barObj).Visible = true;
this works for the Standard, Navigation, Drawing, and Location and Scale toolbars.

the idea of using get_Item comes from here:
http://mp2kmag.com/a103--chandu.thot....mappoint.html

What I don't understand is the get_Item function doesn't even show up in the class... no wonder something like this can be fustrating... when there are hidden class functions!

Surprisingly, as far as my google searching skills are concerned, I am the first person to have figured this out. I hope my google searching skills are just bad, rather than have this dubious honor. Can support for mappoint in C# be this bad?

I thought C# was a first class language in the eyes of Microsoft. I would prefer if Microsoft would not support MapPoint for C# at all, rather than giving me the impression that, since there exists a component for C#, and it's a Microsoft product, it must be fully functional. If there was no component in C#, then I'd have learn VB instead. I resist learning VB because I come from a C++ background and like the familiarity.

The things I learn through trial and error. Sorry if this sounds like a rant... it's just that I've spent a lot of time trying to figure this out.

[/code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Nice,

I have another problem. I cant adjust the preferred arrival and departure times of a waypoint. I always get the message "Access Denied" (also posted here) I tried with a IEnumerator, foreach,... Only with the get_Item() I dont know what object I need to give.

The example in msdn is something like Control.ActiveMap.ActiveRoute.Waypoints(.Items??? not sure).Prefered... = time;

If I do it this way it wont work in C#.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
one thing you might do to make life easier on yourself is use the waypoint class, so you can play with the waypoint object that is returned when you add a location/pushpin to a stop. like so:

Code:
MapPoint.Waypoint way = route.Waypoints.Add(location, nameOfStop);
way.PreferredDeparture.AddHours(1);
the above compiled fine for me. i tried setting the preferreddeparture time directly,

Code:
way.PreferredDeparture = System.DateTime.Parse("4/14/04");
and although it compiled fine i did get the access denied error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Thank you!!!

Searched for hours on this and didn't find it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
heh, that's the problem. there ain't much documentation out there
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-12-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Something is wrong, I did the following:


Code:
way = ActiveMap.ActiveRoute.Waypoints.Add(pin,locationarray[i].Name);
				MessageBox.Show(this, way.PreferredArrival.ToLongTimeString());
				way.PreferredArrival.AddHours(5);
				MessageBox.Show(this, way.PreferredArrival.ToLongTimeString()); 
				way.PreferredArrival.AddMinutes(Convert.ToDouble(preferredarrivalarray[i].Minute));
				way.PreferredArrival.AddSeconds(Convert.ToDouble(preferredarrivalarray[i].Second));
And the time is ALWAYS 0:00:00 (also after adding 5 hours )

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-13-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
when i have an extra moment i'll see if i can help you out

in the meantime, i found a way to get the current selection on a map in C#

Code:
private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
	MapPoint.Pushpin pin = null;
	pin = (MapPoint.Pushpin) curMap.Selection;
	MessageBox.Show(pin.Name);
}
you get an error message if you don't typecast it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
answer, mappoint, show, toolbars


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/answer-how-show-mappoint-toolbars-c-2825.html

Posted By For Type Date
lewinmadrid's MapPoint Bookmarks on Delicious This thread Refback 09-11-2008 10:26 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Locking mappoint toolbars Varrus MapPoint 2006/2009 Discussion 1 05-11-2006 04:12 PM
Nobody knows the answer? How to retrieve the name of country Abilio Serafim MapPoint 2006/2009 Discussion 1 04-29-2005 11:09 AM
Show toolbars in Control Anonymous MapPoint 2006/2009 Discussion 4 11-19-2004 03:04 PM
PLZ... answer me coz am very very new ! tracking_sys MapPoint 2006/2009 Discussion 0 01-28-2004 02:43 AM
27/10/01 Thanks for your previous answer but the .... Anonymous MapPoint 2006/2009 Discussion 1 10-27-2001 12:42 AM


All times are GMT -5. The time now is 02:07 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54