Mouse Position While Dragging and Dropping

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!
 
D

DeveloperX

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.
 

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