Move cursor to panel coordinates...

lidds

Well-known member
Joined
Oct 19, 2004
Messages
122
Programming Experience
Beginner
I have a remote piece of software that allows the users cursor to be controlled from another machine.

My software has a Server and Client form which both have a panel control docked to fill the forms. When the cursor moves over the panel control on the Server form it send the cursor coordinates back to the Client form, these coordinates are the position of the cursor within the panel control, which is what I want. The problem is that I am unable to move the cursor on the Client form to the same position because there is not a me.myPanel.cursor.position command, but only a cursor.position command which sets the cursor position but on the desktop/monitor.

So my question is, if there is a way that I can move the cursor to the same position on the Client form panel as the coordinates sent from the Server form panel?

Thanks in advance

Simon
 
Each control has a PointToClient method that translates screen coords to client.
Better yet, use e.Location property of the panels MouseMove event, it is client coords.
 
JohnH,

Currently I am using the e.Location e.g. e.X and e.Y coordinates of the panel MouseMove event as you have stated, and these are the coordinates that are sent to the Client form. However the only way that I can find of moving the mouse was cursor.position, but what I really need is a me.clientPanel.cursor.position that I can set to the Server e.Location coordinates that are passed.

Thanks

Simon
 
Yes, of course, each control also has a PointToScreen method that translates client coords to screen ones. So you send the panel client coords (e.Location), then at receiver you get the screen point and set cursor.
 
Back
Top