- [Instructor] Now there is one more event of interest here,…the movement of the mouse itself,…so we can track its position across the panel.…So let's go to the designer.…With the panel selected.…Go to the event's dialogue,…the properties dialog where it says Events.…And we look for MouseMove.…I'll double click MouseMove.…And it generates the event handler for me.…Now in here we want to keep track…of the position of the cursor.…The position of the mouse cursor…is available from windows forms.…

In this case, the e variable has the position…both as an X and as a Y variable,…and it will use this to calculate the difference between…the position of the mouse once the button is depressed…and the position of the mouse…while the mouse is moving over the panel itself.…So, what do I mean?…So, on mouse down, we want to keep track…of the position where the mouse started.…There many ways to do this,…I'm just using this as a reference point.…So, once the mouse is pressed…based on where you start the mouse down action,…then the distance that you move it,…

Resume Transcript Auto-Scroll

Author

Released

10/31/2018

Successful programmers know more than just how to code. They also know how to think about solving problems. Code Clinic is a series of courses in which our instructors solve the same problems using different programming languages. In each course, instructors provide tips and tricks for working in a particular language and help you grasp why you might want to learn one language over another. Here, Anton Delsink works with C#. Throughout the course, Anton introduces challenges and then provides an overview of his solutions in C#. Challenges include topics such as geolocation, face recognition, and accessing peripherals. Visit other courses in the series to see how to solve the same challenges in languages like C++, JavaScript, PHP, Python, Ruby, Go, and Swift.