欢迎光临
我们一直在努力

在MapX中响应滚轮放大缩小地图-.NET教程,VB.Net语言

建站超值云服务器,限时71元/月

’模块中

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

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在MapX中响应滚轮放大缩小地图-.NET教程,VB.Net语言
分享到: 更多 (0)