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 9 of 9

New user Zoom in/out code pointers

This is a discussion on New user Zoom in/out code pointers within the MapPoint Desktop Discussion forums, part of the Map Forums category; hi all I have a simple task to learn a little about the workings of the api. I can zoom ...

  1. #1
    Enigma is offline Junior Member White Belt
    Join Date
    Aug 2006
    Posts
    9

    New user Zoom in/out code pointers

    hi all

    I have a simple task to learn a little about the workings of the api. I can zoom in or out of a displayed map by using the keyboard short cuts but I would like to do this with a single key for each operation. Has anyone any pointers or code examples for this?. I am more used to Borland C than MS Basic.

    Cheers Pete

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I'm not sure if I understeand your question, but you can use the form's KeyDown event if you set KeyPreview to true. More or less the same as in Borland CBuilder.

  3. #3
    Enigma is offline Junior Member White Belt
    Join Date
    Aug 2006
    Posts
    9
    Thanks for the reply Wilfried, probably didnt make the question clear. Assuming I am displaying a map which is centered on my current position, I wish to be able to send a command to mappoint to either zoom in or out. I could do this with keyboard commands but I suspect using the api is a better method. I would like some tips or a little code to assist. I have ordered the mapoint.net book but its yet to arrive.

    Best wishes Pete

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    You have these methods ActiveMap.ZoomIn() and ActiveMap.ZoomOut() and as an alternative you can set ActiveMap.Altitude = altitude to a very specific zoom level.

  5. #5
    Enigma is offline Junior Member White Belt
    Join Date
    Aug 2006
    Posts
    9
    Hi Wilfried

    Have you or could you point me to an example in C or C++ of using one of the methods you mention. I have written mainly embedded code and have little experience of windows programming especially interacting with other applications.

    Cheers Pete

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Pete,

    This is example in C#. MP is the componentname of the ActiveX component dropped on a form. I dont know if you use the ActiveX or the object model. But theoretical it is the same.

    Code:
            private void inToolStripMenuItem_Click(object sender, EventArgs e)
            {
                MP.ActiveMap.ZoomIn();
            }
    
            private void outToolStripMenuItem_Click(object sender, EventArgs e)
            {
                MP.ActiveMap.ZoomOut();
            }

  7. #7
    Enigma is offline Junior Member White Belt
    Join Date
    Aug 2006
    Posts
    9
    Hi Wilfried

    What would you recommend, ActiveX or object for this interface?. Can you also advise as to the most suitable language to code in, I know C and C++ but am not adverse to learning something else if its more appropriate.

    Cheers Pete

  8. #8
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Pete,

    You can use any language that support AcitveX and/or COM. But some languages depending on the compiler version do not support the ActiveX component. For example CBuilder or Delphi <= 7 cannot. There you have to do the object model.

    Most examples you will find are in VB and also many in C#. So that is also advantage, on the other hand if you program you can read almost any language in exception of small obscure likely coding, but then you can ask on forums.

    If you used to C / C++ and you compiler support the ActiveX then wy change ?

    As for object model or ActiveX, the advantage of using the activeX is that you only have to click for event handlers and setting some properties. Specially in a learning phase or to do some quick testing is this time improvement. In a later stage you know it in your head and you type it as fast as one other double clicks

  9. #9
    Enigma is offline Junior Member White Belt
    Join Date
    Aug 2006
    Posts
    9
    Many thanks!, Think I`ll use the ActiveX environment for this. Time for a little reading up on the subject!

    Cheers Pete

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Drawing / Zoom
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-04-2005, 07:59 AM
  2. Getting the Zip code and City when user Clicks Map
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-21-2005, 03:39 AM
  3. c# zoom to object
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 12-17-2004, 05:32 PM
  4. Zoom to Waypoint
    By BobIDEAS in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-08-2004, 02:41 PM
  5. Zoom In and Zoom Out event detection
    By victorf in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-22-2003, 01:56 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