Moving cursor c# (cursor.position/cursor.clip not working) -


i trying set cursor in region of screen.

i using following method:

this.cursor = new cursor(cursor.current.handle); cursor.position = new point(cursor.position.x - 50, cursor.position.y - 50);  cursor.clip = new rectangle(this.location, this.size); 

however nothing happens when code executed. can tell me what's going on?

you shouldn't write line

this.cursor = new cursor(cursor.current.handle); //remove it

here set region mouse cursor be. should first line if want "lock" mouse cursor in rectagle. if don't want comment line.

cursor.clip = new rectangle(this.location, this.size);

then can put cursor in position

cursor.position = new point(500, 500);

small example show how can work.

// after first run uncomment line , see mouse "locking" in form ===> cursor.clip = new rectangle(this.location, this.size);     (int = 0; < 600; i++)     {         //here move cursor.         //we current position , shift 1.         cursor.position = new point(cursor.position.x - 1, cursor.position.y - 1);         //sleep 100ms         thread.sleep(100);     } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -