In the MAPX response wheel zoom in to reduce the map

Source: Internet
Author: User
Zoom In | response
' Module

Option Explicit

Public Const Gwl_wndproc = (-4)
Public Const wm_command = &h111
Public Const Wm_mbuttondown = &h207
Public Const Wm_mbuttonup = &h208
Public Const WM_MouseWheel = &h20a

Public Oldwinproc as Long
Public Declare Function SetWindowLong Lib "user32" Alias "Setwindowlonga" (ByVal hWnd as Long, ByVal nindex as Long, ByVal Dwnewlong as long) as long
Public Declare Function CallWindowProc Lib "user32" Alias "Callwindowproca" (ByVal Lpprevwndfunc as Long, ByVal hWnd as Lo Ng, ByVal Msg as Long, ByVal WParam as Long, ByVal LParam as long) as long
Public Declare Function GetWindowLong Lib "user32" Alias "Getwindowlonga" (ByVal hWnd as Long, ByVal nindex as Long) as Lo Ng

Public Function Flexscroll (ByVal hWnd as Long, ByVal wmsg as Long, ByVal WParam as Long, ByVal LParam as long) as long
Select Case Wmsg
Case WM_MouseWheel
Select Case WParam
Case-7864320 ' Roll down
Setcurrentscale "Zoomout", 2
Case 7864320 ' roll up
Setcurrentscale "ZoomIn", 2
End Select
End Select

Flexscroll = CallWindowProc (Oldwinproc, HWnd, wmsg, WParam, LParam)
End Function



Private Sub Setcurrentscale (strinorout as String, Dscale as Double)
If Frmmain.map1 is nothing Then Exit Sub

If strinorout = "ZoomIn" Then
FrmMain.Map1.Zoom = (frmMain.Map1.Zoom) * Dscale
FrmMain.Map1.Refresh
ElseIf strinorout = "Zoomout" Then
FrmMain.Map1.Zoom = (frmMain.Map1.Zoom)/Dscale
FrmMain.Map1.Refresh
End If
End Sub







Private Sub Form_Load ()

Oldwinproc = GetWindowLong (Map1.hwnd, GWL_WNDPROC)
SetWindowLong Map1.hwnd, GWL_WNDPROC, AddressOf flexscroll

End Sub

Private Sub form_unload (Cancel as Integer)
SetWindowLong Map1.hwnd, GWL_WNDPROC, Oldwinproc
End Sub




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.