Results 1 to 4 of 4

Thread: Move a picture box into a form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84

    Question Move a picture box into a form

    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.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Here is a quick sample for you:
    VB Code:
    1. Option Explicit
    2.  
    3. Dim intOffsetX As Integer
    4. Dim intOffsetY As Integer
    5.  
    6. Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
    7.     Source.Drag vbEndDrag
    8.     Source.Move X - intOffsetX, Y - intOffsetY
    9. End Sub
    10.  
    11. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    12.     If Button = vbLeftButton Then
    13.         Picture1.Drag vbBeginDrag
    14.         intOffsetX = X
    15.         intOffsetY = Y
    16.     End If
    17. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84

    Resolved (RESOLVED)

    Thank you very much RB, it work's perfectly.

    Regards.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Resolved

    add the checkmark to the first post in the thread to resolve it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width