Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Answer: How to show mappoint toolbars with C#

This is a discussion on Answer: How to show mappoint toolbars with C# within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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]

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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#.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thank you!!!

    Searched for hours on this and didn't find it.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    heh, that's the problem. there ain't much documentation out there

  6. #6
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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 )


  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96