title: Calculate distance between two mouse points
body: <p>I need to calculate the distance between two places the mouse was clicked on the screen.  </p>
  
  <p>target(x &amp; Y) &amp; source(X &amp; Y) are populated on the mouse move event (e.X &amp; e.Y) </p>
  
  <p>I have <code>distance = Math.Sqrt(Math.Pow(targetX - sourceX, 2) + Math.Pow(targetY - sourceY, 2));</code></p>
  
  <p>This gives me a result but if I'm honest I am not sure what unit the measurement is in or how to convert it.  How can I convert that result in a meaningful result such as cm's or inches?  I'm guessing I will need to take the screen res into account?</p>
  
  <p><strong>Update</strong>
  Im just killing time really. Not looking for an excellent solution just something that works.  It will only last a day or two.</p>
  
  <p>Here is the <code>MoveMove</code> event and the call made.  Should have posted it all before to be clearer. </p>
  
  <pre><code>    private void HookManager_MouseMove(object sender, MouseEventArgs e)
      {
  
          labelMousePosition.Text = string.Format("x={0:0000}; y={1:0000}", e.X, e.Y);
          AddDistance(Convert.ToDouble(e.X), Convert.ToDouble(e.Y));
      }
  
      private void AddDistance(double targetX, double targetY)
      {
          if (sourceX != 0 &amp;&amp; sourceY != 0)
          {
              double distance = Convert.ToDouble(lblDistanceTravelled.Text);
              distance =+ Math.Sqrt(Math.Pow(targetX - sourceX, 2) + Math.Pow(targetY - sourceY, 2));
              lblDistanceTravelled.Text = distance.ToString();
          }
          sourceX = targetX;
          sourceY = targetY;
      }
  </code></pre>