Hi,
I am trying to get my image to move when I hold the mouse down and drag it. I have some code which sort of works but the image is very judddery and not at all smooth when being dragged. Can anyone help?
See code below;
-----------------------------
I am trying to get my image to move when I hold the mouse down and drag it. I have some code which sort of works but the image is very judddery and not at all smooth when being dragged. Can anyone help?
See code below;
-----------------------------
PHP:
Private Sub PicImageSingle_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PicImageSingle.MouseDown
Dim MousePoint As New Point(e.X, e.Y)
Dim ImagePoint As New Point(Me.PicImageSingle.Left, Me.PicImageSingle.Top)
MousePoint = Me.PicImageSingle.PointToClient(MousePoint)
ImagePoint = Me.PicImageSingle.PointToClient(ImagePoint)
m_DeltaX = MousePoint.X - ImagePoint.X
m_DeltaY = MousePoint.Y - ImagePoint.Y
End Sub
Private Sub PicImageSingle_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PicImageSingle.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim MousePoint As New Point(e.X, e.Y)
Dim ImagePoint As New Point(Me.PicImageSingle.Left, Me.PicImageSingle.Top)
Me.PicImageSingle.Left = MousePoint.X - m_DeltaX
Me.PicImageSingle.Top = MousePoint.Y - m_DeltaY
End If
End Sub