1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Option Explicit
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Dim toto As Integer
toto = Me.ScaleMode
Me.ScaleMode = vbTwips
DoEvents
If Me.Top + Y <= 0 Then Exit Sub
If Me.Left + X <= 0 Then Exit Sub
If Me.Left + X + Me.Width >= Screen.Width Then Exit Sub
If Me.Top + Y + Me.Height >= Screen.Height Then Exit Sub
Me.Move Me.Left + X, Me.Top + Y
SetCursorPos ScaleX(Me.Left, ScaleMode, vbPixels), ScaleY(Me.Top, ScaleMode, vbPixels)
Me.ScaleMode = toto
End Sub
Private Sub aie()
SetCursorPos ScaleX(Me.Left, ScaleMode, vbPixels), ScaleY(Me.Top, ScaleMode, vbPixels)
End Sub |
Partager