在MapX中响应滚轮放大缩小地图

原创 2005年04月26日 15:14:00

’模块中

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

VC+MapX 地图的放大,缩小,漫游,归心功能的实现

有了前面在主视图中创建地图

VC++环境下Mapx地图的加载

加载显示电子地图          2.1.给单文档工程IntTranspSystem加入MapX控件。在MapX安装目录中找到Samples40子目录,在这个目录中有两个子目录CPP和VBAsia...
  • Y1M00N
  • Y1M00N
  • 2012年05月07日 12:33
  • 835

3S基础知识:MapX应用教程—创建地图对象

创建地图对象,必须使用FeatureFactory对象。

滚轮实现多个svg的放大缩小

  • 2017年08月22日 17:07
  • 5KB
  • 下载

ExtJs 完美实现图片在Window窗口中通过鼠标滚轮放大缩小以及点击拖拽

ExtJs 完美实现图片在Window窗口中通过鼠标滚轮放大缩小以及点击拖拽以下内容需要一定的ExtJs以及Js知识基础 ExtJs 完美实现图片在Window中通过鼠标滚轮放大缩小以及点击拖拽以下...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:在MapX中响应滚轮放大缩小地图
举报原因:
原因补充:

(最多只允许输入30个字)