I'm making a maze game for part of my college course and I need to have the mouse spawn in a specific location when the form loads. How would I do this?
Thanks in advance.
How do you position the mouse on form load
Page 1 of 19 Replies - 463 Views - Last Post: 15 March 2012 - 06:04 AM
Replies To: How do you position the mouse on form load
#2
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:31 AM
hello
u can use this:
Declare the function
or, this:
hope this helps!
u can use this:
Declare the function
Declare Function SetCursorPos& Lib "user32" (ByVal p As Point) dim p as point p.x = 100 p.y = 200 SetCursorPos p
or, this:
Windows.Forms.Cursor.Current.Position = New System.Drawing.Point(225, 105)
hope this helps!
#3
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:36 AM
Neither seem to work correctly for me
#4
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:40 AM
did you put the Windows.Forms.Cursor.Current.Position = New System.Drawing.Point(225, 105) inside your form load sub or outside it?
#5
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:42 AM
Inside the load form but it loads at a completely different point to where I need it, even when I enter the correct coordinates
#6
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:44 AM
well, when you enter different coordinates, does the mouse position change or it is the same regardless of what coordinates you set?
#7
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:47 AM
It changes but when it does the form position changes when it loads :|
#8
Re: How do you position the mouse on form load
Posted 15 March 2012 - 05:58 AM
try to set the Start Position property of the form to CenterScreen. Is that working?
i dont know why..this should work... try it this way. type this in the form load sub:
i dont know why..this should work... try it this way. type this in the form load sub:
Dim PositionX As Integer Dim PositionY As Integer PositionX = 100 PositionY = 300 Cursor.Position = New Point(PositionX, PositionY)
#9
Re: How do you position the mouse on form load
Posted 15 March 2012 - 06:01 AM
rusoaica, on 15 March 2012 - 05:58 AM, said:
try to set the Start Position property of the form to CenterScreen. Is that working?
i dont know why..this should work... try it this way. type this in the form load sub:
i dont know why..this should work... try it this way. type this in the form load sub:
Dim PositionX As Integer Dim PositionY As Integer PositionX = 100 PositionY = 300 Cursor.Position = New Point(PositionX, PositionY)
This worked, thanks!
#10
Re: How do you position the mouse on form load
Posted 15 March 2012 - 06:04 AM
glad i could help you! 
Live long and prosper! \\//_
Live long and prosper! \\//_
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|