Drawing and Form

Pals. how can I move the drawing inside the form  for example if I move the rectangle drawing up to the edge of the form the rectangle drawing will be look like a half rectangle...

tanx in advance, hope you get my point


Answer this question

Drawing and Form

  • Egil Hansen131755

    Are you talking about dragging the rectangle around the form

    Classic example of click n drag, 
    You need to use three event handler methods
    OnMouseDown
    OnMouseUp
    OnMouseMove

    Use a bool called mouseDragging to know if you're dragging. 
    Record the position of the MouseDown.
    OnMouseMove, take the difference in the new position vs old position
    add the difference to the rectangle's location.
    OnMouseUp, set mouseDragging to false.

    Let me know if it's what you're looking for.

  • Drawing and Form