Moving objects on a form with the mouse

Discussion in 'Visual Basic ( VB )' started by djvargas, Jul 11, 2006.

  1. djvargas

    djvargas New Member

    Jul 11, 2006
    Likes Received:
    Trophy Points:

    I am a new member to this forum, so please forgive/correct me if I am posting incorrectly.

    Can anyone help me with a way to move an object on the form (when compiling) by using the mouse? More specifically - I want to find a way to pick up a picture box via left-mouse click and drag it to any position on the form. Once I release left-mouse, the picture box will remain in that position. Any ideas?

    I would like to either get the picture to move from point A to B in either of these manners:

    1. Pick up and drag picture box
    2. Click picture box, then click on form location (unused form space, not on top of another object)

    Thank you for any suggestions :)
  2. shabbir

    shabbir Administrator Staff Member

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    Just change the control position by picking it up in LButton Down event and as the mouse is moved change in accordingly and LButton up place it where the mouse was released.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice