Mouse click listener

NachitoMax 416 Reputation points
2021-04-15T05:53:01.84+00:00

Hi

Not even sure if this is possible. I use a design application with a design interface. I need to place points where ever I make a mouse down click but the application doesn't provide a way of doing that. Well, it does but not while a built in process is in operation.

What I would like to do is-
Start a built in tool in the application
Have a mouselistener to record mouse down chords

What I can do with the app is get its top left of the app and also top left of the design window along with its width and height so I could calculate the click point in the window.

Is there a way to do what I'm thinking that is, record the mousedown event and record its coords?

Thanks

Developer technologies .NET Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xingyu Zhao-MSFT 5,381 Reputation points
    2021-04-16T02:29:42.937+00:00

    Hi @NachitoMax ,
    In winform, you can use 'Cursor.Position.X' and 'Cursor.Position.Y' to get the cursor position.
    Then bind to bind to MouseDown event.

            private void Form1_MouseDown(object sender, MouseEventArgs e)  
            {  
                label1.Text = "X:" + Cursor.Position.X;   
                label2.Text = "Y:" + Cursor.Position.Y;   
            }  
    

    Also take a look at:
    Getting mouse position in c#

    Hope them could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.