Results 1 to 10 of 10

Thread: How to record a mouse position?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    47

    How to record a mouse position?

    Howdy.


    I have a button that is labled, Set Mouse.


    I need that to pop up a new form(I know how to do that) That says Click where blah blah, then when they click it says, Now click blah blah, Then after they click the second time, and it records those 2 mouse positions to 2 diffrent things. Thanks!

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: How to record a mouse position?

    You can Use Me.MousePosition to get the mouse postion

  3. #3
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241
    ....
    Last edited by Ashraf Alshahawy; Jun 20th, 2007 at 08:58 AM.
    Some times when you make a step forward ...You can't get back. Be sure where you make your steps.

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    47

    Re: How to record a mouse position?

    Im sorry, I would like to know how to save their mouse position, so that when the timer is up it clicks where they last clicked =)


    I guess both

  5. #5
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241
    ....
    Last edited by Ashraf Alshahawy; Jun 20th, 2007 at 08:58 AM.
    Some times when you make a step forward ...You can't get back. Be sure where you make your steps.

  6. #6
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: How to record a mouse position?

    Piece of cake. I'm not even gonna load up VS for this. Create a List(Of Point), since the Point object has an X and Y, and every time the mouse is clicked, trap the point and add it to the list.

    I lied, I am going to load up VS... bloody event args...
    vb Code:
    1. Dim myclicks As New List(Of Point)
    2.  
    3.     Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
    4.         myclicks.Add(New Point(e.X, e.Y))
    5.     End Sub

    Whenever you need them, every click will have been logged in the myClicks list, which you can loop through very simply:
    vb Code:
    1. For Each p As Point In myclicks
    2.             'do stuff here
    3.         Next

    Hope this helps!

  7. #7
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241
    ....
    Last edited by Ashraf Alshahawy; Jun 20th, 2007 at 08:57 AM.
    Some times when you make a step forward ...You can't get back. Be sure where you make your steps.

  8. #8
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: How to record a mouse position?

    Um.. from his request, he doesn't need to put the mouse anywhere, just record where it's been clicked...

  9. #9
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241
    ....
    Last edited by Ashraf Alshahawy; Jun 20th, 2007 at 08:59 AM. Reason: Rude way while talking
    Some times when you make a step forward ...You can't get back. Be sure where you make your steps.

  10. #10
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: How to record a mouse position?

    My apologies, I missed that post. Regardless, I'm sure .NET has a better way of doing it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width