motion of controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mini
    New Member
    • Apr 2012
    • 1

    motion of controls

    i have a form whit a picturebox and some buttons to move the picturebox.i dont want the user to guide the picturebox out of the form even by dragging the form border picturebox moves just in the form border, and also there is a button to guide the picturebox to the start position(start choose by user).what can i do?
  • RhysW
    New Member
    • Mar 2012
    • 70

    #2
    set up some integer values of largest x value allowed, largest y allowed, smallest x allowed and smallest y allowed, when you move the picture make it run a check that the new coordinates arent exceeding these values, if they are then dont allow the movement

    important note, the pictureboxes coordinates are considered to be its top left point so when figuring out how far right or down it should be allowed to go remember to factor in the length of the picture box itself, otherwise the picture can go outside the area visually, but logically its top corner is still within range.

    hope this helps!

    Comment

    Working...