henszey
12-23-2003, 10:45 PM
I want to be able to hold the left button on the mouse down while over a picture and then move the mouse and have the form follow the mouse
i tried using PictureBox1_MouseDown and watching for when the mouse was moving, but i couldnt get it :S
Machaira
12-24-2003, 06:12 AM
Why? Try:
Private m_x As Integer
Private m_y As Integer
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
If e.Button = MouseButtons.Left Then
m_x = e.X
m_y = e.Y
End If
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = MouseButtons.Left Then
Me.Left = Me.Left + (e.X - m_x)
Me.Top = Me.Top + (e.Y - m_y)
End If
End Sub