Move the map with left click.

Topics: Feature Requests
Sep 14, 2010 at 3:52 PM

Hi,

First of all, thanks for the awesome application you've posted here!! It works perfectly and it saved me a lot of work.

Second, can you tell me where is the code that makes the map moves?? or a way to move the map when we maintain clicked the left button of the mouse???

Thank you VERY MUCH!!!

Coordinator
Sep 14, 2010 at 6:15 PM

map.DragButton = MouseButtons.Right

Sep 15, 2010 at 7:10 AM

Thank you very much!!!

I couldn't find that property!! Awesome! 

Thanks once again!

Sep 16, 2010 at 8:28 PM

You can implement it by mouse down & mouse move events

 

 

add this variables as public variable



int move_x;
        int move_y;

then add this commands in the correct place. these are events of GMAP component

 

mouse-down

 if (e.Button.ToString().Equals(MouseButtons.Left.ToString()))
            {
                flag_move = true;
                MainMap.Cursor = Cursors.Hand;
                move_x = e.X;
                move_y = e.Y;
            }


mouse-move

 int this_x = 0;
            int this_y = 0;
            if (flag_move)
            {
                this_x = e.X - move_x;
                this_y = e.Y - move_y;
           
                MainMap.Offset(this_x, this_y);
                move_x = e.X;
                move_y = e.Y;
            }

 

mouse-up

flag_move = false;
            MainMap.Cursor = Cursors.Arrow;