CodeItBetter Programming Another VB Programming Blog

How to allow Controls to move

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'Controls - How to allow Controls to move

Option Explicit
 
'Add a PictureBox to your form.

Public globalX As Integer
Public globalY As Integer
 
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
    Picture1.Move X - globalX, Y - globalY
End Sub
 
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Picture1.Drag vbBeginDrag
    globalX = X
    globalY = Y
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.