Drag Panel/Image

Can someone tell me how to move a panel across the form with the mouse?
[71 byte] By [VisualC#Novice] at [2007-12-28]
# 1
Handle the MouseMove, MouseDown and MouseUp events of the panel.

When the mouse goes down, set a flag that indicates the mouse is down.

When the mouse moves, if the mouse down flag is set, set the panel's Location property accordingly.

When the mouse button goes up, unset the flag that indicates the mouse is down.

You will probably have to do some coordinate transformation from the panel's coordinates to the mouse's coordinates. You'll have to see how the above behaves in order to determine how to shift the coordinates, as I don't remember offhand. You may actually have to handle the MouseMove event of the panel's container, instead.

theblueeyz at 2007-9-4 > top of Msdn Tech,Windows Forms,Windows Forms Designer...