Move by dragging inside the window?

rahamad
03-27-2003, 05:17 PM
I've got a form that I have no border on, but I want to be able to drag it around the screen by using the picture box that is inside the form. Any ideas how I can do this?

Machaira
03-27-2003, 09:24 PM
Here ya go:

Private iX As Integer
Private iY As Integer
Private bMouseDown As Boolean

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

bMouseDown = True

iX = X
iY = Y

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If bMouseDown Then Me.Move Me.Left - (iX - X), Me.Top - (iY - Y)

End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
bMouseDown = False
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum