Need to track mouse cords in order to move a Panel object

J

Jay

I need to be able to move a Panel on a windows Form at run time using
the mouse. I have tried adding a MouseDown event handler to the Panel
and then within the MouseDown handler adding a MouseMove event to the
Panel and then setting the Panel's Location to a new Point(x, y) with
x and y set to the mouse's x and y, but this does not work because the
MouseDown event of Panel only sends the cords of the mouse within that
Panel. I need to be able to move the Panel within the Form and need to
get the cords of the mouse within the Form in order to set the Panel's
Location.

I've also tried adding a MouseMove event to the Form when the Panel's
MouseDown event is called and then setting the Panel's Location based
on the cords of the Mouse events of the Form, but this has problems
because the Form doesn't receive mouse events while the cursor is
moving within the bounds of the Panel, cause the moving to be very
choppy.

Doesn't anyone have an idea as to how to handle this problem?

Thanks in advance,
I apologize if this has been asked already.
Jason
 

Ask a Question

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.

Ask a Question

Top