Mouse Position While Dragging and Dropping

  • Thread starter Thread starter Emanuel
  • Start date Start date
E

Emanuel

I am trying to make a little diagramming app in C# with the 1.1
Framework (currently our standard here at work, will be upgrading to
2005 sometime in the next couple of months). I want to allow them to
click on a custom control of mine, drag a line to another custom
control, and when they let go draw a connection.

With Drag and Drop I am able to get the start and end controls, and
draw the final connection line, but I cannot for the life of me figure
out how to get the mouse position during the process. Without Drag and
Drop I can capture the mouse and get the position and draw the dynamic
line as you move around, but when you let go I can't seem to figure
out how to tell which control it was over.
From what I have read, I might be able to do this with the 3.0
Framework, but I was wondering if there was some way I'm not thinking
of that would allow me to do it with the 1.1 version. Any help is
appreciated!
 
I am trying to make a little diagramming app in C# with the 1.1
Framework (currently our standard here at work, will be upgrading to
2005 sometime in the next couple of months). I want to allow them to
click on a custom control of mine, drag a line to another custom
control, and when they let go draw a connection.

With Drag and Drop I am able to get the start and end controls, and
draw the final connection line, but I cannot for the life of me figure
out how to get the mouse position during the process. Without Drag and
Drop I can capture the mouse and get the position and draw the dynamic
line as you move around, but when you let go I can't seem to figure
out how to tell which control it was over.


Framework, but I was wondering if there was some way I'm not thinking
of that would allow me to do it with the 1.1 version. Any help is
appreciated!


Console.WriteLine(Cursor.Position.ToString());

Console.WriteLine(PointToClient(Cursor.Position).ToString());

The first gets the cursors position relative to the screen, and the
latter converts it to coordinates local to the client.
 
Back
Top