Click here to Skip to main content
16,020,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to calculate the angle between the 1st and the final point while drawing something as soon as I lift the mouse in a WPF application in C#. How do I do it ?
Posted

Technically there is no angle between two points (two points define a vector, you need two vectors to have an angle between). If you meant "I need the angle between the vector (x,0) (that is the 'horizontal line') and the vector defined by the two points" then the OriginalGriff's solution is the right one..
 
Share this answer
 
Handle the MouseDown event, and save the Loction.
Handle the MouseUp event, and get the new Location.
The angle is
C#
double angle = Math.Atan2(y1-y2,x1-x2); 
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900