# Pan event with move mouse and pressed left click with mapwingis

**URL:** <https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631>\
**Category:** MapWinGIS\
**Created:** [June 24, 2020, 4:15am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631 "2020-06-24T04:15:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiennguyen](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tiennguyen](https://mapwindow.discourse.group/u/tiennguyen)\
**Post date:** [June 24, 2020, 4:15am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/1 "2020-06-24T04:15:12Z")

</div>

hi everyone. I have a problem which I haven’t solved it. I want to create “Pan event” whenever I pressed left mouse and move it on the map. However, I still have not solved it.  
Can you help me. Thanks a lot

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [June 24, 2020, 5:11am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/2 "2020-06-24T05:11:50Z")

</div>

Hello @tiennguyen

You can set up the ExtentsChanged event, which will occur on a Pan or Zoom. But on a Pan, the Extents Width and Height will not change. So in the event, always save the previous Extents, then compare it with the current Extents Width and Height. If they have not changed, you know that the map was Panned.

Hope that helps.  
Jerry.

---

<div class="post-metadata">

**Author:** ![tiennguyen](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tiennguyen](https://mapwindow.discourse.group/u/tiennguyen)\
**Post date:** [June 24, 2020, 6:36am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/3 "2020-06-24T06:36:49Z")

</div>

Thank you for your answer. However, I think there is a small confusing here. My aim is that:  
Each time I pressed left mouse and move mouse on axMap ( two trigger happens at the same time), I want to program my Map will be pan like Pan event of googlemap.

https://maps.google.com/maps?ll=21.0731225,105.9548394&z=15&output=embed&dg=ntvb
  
Can you tell me how to do it. thanks a lot.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [June 24, 2020, 10:13pm UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/4 "2020-06-24T22:13:43Z")

</div>

If I’m now understanding, what you’re looking for is the Pan tool? Is this correct?

```
axMap1.CursorMode = tkCursorMode.cmPan;
axMap1.MapCursor = crsrMapDefault;
```

---

<div class="post-metadata">

**Author:** ![tiennguyen](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tiennguyen](https://mapwindow.discourse.group/u/tiennguyen)\
**Post date:** [June 25, 2020, 7:33am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/5 "2020-06-25T07:33:36Z")

</div>

Yes. I want to use pan tool. However, I want to when I press left mouse down, hold and move it, map will be pan. When I realease mouse, map will not pan tool.  
I try it some ways, but it has failed.  
Can you suggess some idea? Thanks a lot

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [July 24, 2020, 8:08am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/6 "2020-07-24T08:08:45Z")

</div>

Did you tried Jerry’s suggestion? It should work like you need.

---

<div class="post-metadata">

**Author:** ![tiennguyen](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tiennguyen](https://mapwindow.discourse.group/u/tiennguyen)\
**Post date:** [July 24, 2020, 10:10am UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/7 "2020-07-24T10:10:19Z")

</div>

thank for your answer. I solved it. Thanks a lot

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [July 24, 2020, 12:31pm UTC](https://mapwindow.discourse.group/t/pan-event-with-move-mouse-and-pressed-left-click-with-mapwingis/631/8 "2020-07-24T12:31:12Z")

</div>


