Hi:
I have a problem, how can I move a picture box into a form in run time?, I mean, I want to change the position with the drag drop procedure, Does anybody know how can I do it?
Thanks a lot, and regards.
Printable View
Hi:
I have a problem, how can I move a picture box into a form in run time?, I mean, I want to change the position with the drag drop procedure, Does anybody know how can I do it?
Thanks a lot, and regards.
Here is a quick sample for you:
VB Code:
Option Explicit Dim intOffsetX As Integer Dim intOffsetY As Integer Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) Source.Drag vbEndDrag Source.Move X - intOffsetX, Y - intOffsetY End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then Picture1.Drag vbBeginDrag intOffsetX = X intOffsetY = Y End If End Sub
Thank you very much RB, it work's perfectly.
Regards.
add the checkmark to the first post in the thread to resolve it!