How To Get Mouse Location(X,Y) In C#

I know this is very basic but i am bored so writing this .
The program we are going to make will show you the mouse cursor location, okay first of all click your form and then go to event (the lightning icon in your properties tab) and then search for MouseMove and just double click on it.
How To Get Mouse Location(X,Y) In C#
After that you will fall into the mouse_move event , go to designer and add two labels and just write down the below codes in MouseMove
label1.Text = "X : "+e.X.ToString();
            label2.Text = "Y : "+e.Y.ToString();

Now debug and try moving your mouse .

1 comments:

Post a Comment

Note: Only a member of this blog may post a comment.