Public Function GetMsgProc(ByVal nCode As Long, ByVal wParam As Long, lParam As MSG) As Long
Dim PosX As Long
Dim PosY As Long
If lParam.message = WM_MOUSEWHEEL Then
If Objet.Rows = Objet.FixedRows Then Exit Function
Feuille.ScaleMode = 3
PosX = lParam.pt.x - Feuille.ScaleX(Feuille.Left, vbTwips, vbPixels)
PosY = lParam.pt.y - Feuille.ScaleY(Feuille.Top, vbTwips, vbPixels)
'On se trouve à l'intérieur de l'Objet
If PosX > Objet.Left And PosX < (Objet.Left + Objet.Width) And _
PosY > Objet.Top And PosY < (Objet.Top + Objet.Height) Then
If lParam.wParam > 0 Then
' On est en haut de la feuille
If Objet.TopRow - MaxRoulette <= Objet.FixedRows Then
Objet.TopRow = Objet.FixedRows
Feuille.ScaleMode = 1
Exit Function
End If
If Objet.TopRow > Objet.FixedRows Then Objet.TopRow = Objet.TopRow - MaxRoulette
Else
If Objet.TopRow + MaxRoulette < Objet.Rows - 1 Then _
If Objet.TopRow < Objet.Rows - 1 Then Objet.TopRow = Objet.TopRow + MaxRoulette
End If
End If
Feuille.ScaleMode = 1
End If
'GetMsgProc = CallNextHookEx(Ihook, nCode, wParam, lParam)
End Function
Public Sub OpenHook(Parm1 As Form, Parm2 As MSHFlexGrid)
Set Objet = Parm2
Set Feuille = Parm1
Ihook = SetWindowsHookEx(WH_GETMESSAGE, AddressOf GetMsgProc, App.hInstance, App.ThreadID)
End Sub
Public Sub CloseHook()
UnhookWindowsHookEx Ihook
Set Objet = Nothing
Set Feuille = Nothing
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question