Handle the MouseMove/MouseDown/MouseUp events on your control. Keep track
of where the mouse was last and calculate the offset when the MouseButton is
down. Adjust the Location property of the Control accordingly. It will
appear to be draggable.
Something along the lines of ...
OnMouseDown
startPosition = current position
OnMouseMove
if(MouseButtons.Left)
newPosition = current position
offset = newPosition - startPosition
adjustLocation(offset)
startPosition = newPosition
Handle the MouseMove/MouseDown/MouseUp events on your control. Keep track
of where the mouse was last and calculate the offset when the MouseButton is
down. Adjust the Location property of the Control accordingly. It will
appear to be draggable.
Something along the lines of ...
OnMouseDown
startPosition = current position
OnMouseMove
if(MouseButtons.Left)
newPosition = current position
offset = newPosition - startPosition
adjustLocation(offset)
startPosition = newPosition
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.