CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2009
    Posts
    3

    need code for c# to give mouse position when left mouse button...

    need code for c# to give mouse position when left mouse button is clicked ...

    Can some one help me in c# .. in my app, I want to have app return to me the SCREEN (nor Form) coordinates of mouse pointer when the left mouse button is clicked ....

    I know this can be done, but I can't quite write the code to do it properly .... if anyone could help me, that would just be great.

    Thank you.

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: need code for c# to give mouse position when left mouse button...

    Cursor.Position

  3. #3
    Join Date
    Sep 2009
    Posts
    3

    Re: need code for c# to give mouse position when left mouse button...

    But how do I 'watch for & detect' the 'left mouse click' ?

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: need code for c# to give mouse position when left mouse button...

    You want to detect a mouse click at any time? That would require a hook into the OS. If you want to be notified when your form is clicked simply handle OnMouseClick or OnMouseDown.

    Here is an article on how to set a hook using C#:

    http://support.microsoft.com/kb/318804
    Last edited by BigEd781; September 18th, 2009 at 09:45 PM.

  5. #5
    Join Date
    Sep 2009
    Posts
    3

    Re: need code for c# to give mouse position when left mouse button...

    I will check it out ... thanks so much

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

Featured