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 long, 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 long
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 '向下滚 setcurrentscale "zoomout", 2 case 7864320 '向上滚 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