Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Positioning the cursor using Cursor.Position

Status
Not open for further replies.

benlogan1981

Programmer
Dec 9, 2001
14
GB
Hi

I am trying to set the position of the cursor manually using the following code...

Cursor.Position = new Point(screenX, screenY);

The idea is to basically move the mouse pointer inline with the movement of a human player in a game.

The problem is when I use this call it messes everything up, the player isn't even drawn any more. Even when...

int screenX = Cursor.Position.X;
int screenY = Cursor.Position.Y;

which I would have thought would result in no change at all. Will this manual positioning of the cursor trigger mouse events.

I guess I am just looking for some general advice in this area as I am getting unexpected results.

Thanks

Ben
 
How are you getting the Cursor object? Are you doing something like this?
Code:
Cursor myCursor = new Cursor(Cursor.Current.Handle);
Chip H.



____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top