Pointer Dragdrop

zack

Well-known member
Joined
Jun 9, 2005
Messages
65
Programming Experience
Beginner
Hi all,

I want to have the pointer in my PPC which can actually drag a map/picture when the user clicks on it.

Any ideas how to do it?
 
Hi all,

This is my solution:

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
bDragging = True
sx = e.X
sy = e.Y
End Sub

Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
bDragging = False

End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove

If bDragging Then
With PictureBox1
nx = .Left - sx + e.X
ny = .Top - sy + e.Y
.Location = New System.Drawing.Point(nx, ny)
End With
End If

End Sub
 
Back
Top