I can calculate horizontal and vertical points, but I cannot figure out how to calculate distance using diagonal points. Can anyone help me with this.
here is the code for my horizontal and vertical measurement:
private float ComputeDistance(float point1, float point2) { float sol1 = point1 - point2; float sol2 = (float)Math.Abs(Math.Sqrt(sol1 * sol1)); return sol2; } protected override void OnMouseMove(MouseEventArgs e) { _endPoint.X = eX; _endPoint.Y = eY; if (ComputeDistance(_startPoint.X, _endPoint.X) <= 10) { str = ComputeDistance(_startPoint.Y, _endPoint.Y).ToString(); } else { if (ComputeDistance(_startPoint.Y, _endPoint.Y) <= 10) { str = ComputeDistance(_startPoint.X, _endPoint.X).ToString(); } } }
Assuming _startPoint is already installed.

In this image, the diagonal point is obviously incorrect.
c # winforms distance gdi
Rye
source share