FAtechs is a Web Site where you can find a lot of things related to tech and Education. Our Posts are mostly about Programming, Information, Technology,Software, Reviews & Everything You need to Know. You can also find Books and Novels here. Your appreciation and criticism will be welcomed.
Checking Mouse Directions in Windows Form Application, Step by Step
Mouse Directions in Windows Form:
We can check the mouse directions on Windows Form Application using the events of mouse_move on the Win Form. For example we want to check that in which direction the mouse is moving in our Application such as a game like subway surfer.
Here we will learn how to check the movement Directions of a mouse in Windows Form App using C#.
Following are the Steps:
First of all open the Windows Form Application is C#, and add a label and place it in middle of the Form like picture below.
Write the following code in Form1.cs Class:
public partial class Form1 : Form
int cnt = 0; // i am taking this as i want to run a code only for the first time
int my_x, my_y; // we will store the mouse position (x axis, y axis) in these variables