PDA

View Full Version : dotNet Mouse Position


PEN
09-04-2009, 03:03 AM
There just has to be a way to get the mouse position at any time? I have found "input.mouse" and then .getPosition but it is looking for something and I'm not sure what to provide it.

Any one?

Gravey
09-04-2009, 04:49 AM
a quick google search turned up this:
http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=50188

basically you can use the System.Windows.Forms.Cursor class to get / set the position of the mouse on screen like this:cursor = dotnetclass "System.Windows.Forms.Cursor"
-- get the position, returns a System.Drawing.Point
p = cursor.Position
-- move the mouse 200 units to the right
cursor.Position = dotnetobject "System.Drawing.Point" (p.x+200) p.yWhen i tried it, i had trouble accessing the cursor.position.X and .Y properties directly, storing the point in a variable first solved the problem

PEN
09-04-2009, 03:02 PM
I didn't even think to go through the cursor calls. Thanks.

CGTalk Moderation
09-04-2009, 03:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.