PointPair point = curve[iPt]; string StringPointValue = string.Format("X:{0} \nY: {1:F4}", point.X, point.Y); return StringPointValue; 

The essence of this, when you point the mouse at a point, it displays a point. So the numbers show, but if this number is more than 2 then it outputs zeros, why?

  • one
    Well, let's set the formatting string correct. For X:{0} should output everything, without rounding, for Y:{1:F4} should output a value with 4 decimal places. But what control do you use, what PointPair class and what is WinForms or WPF? - rdorn

1 answer 1

What will be displayed if instead of:

 string StringPointValue = string.Format("X:{0} \nY: {1:F4}", point.X, point.Y); 

put:

 string StringPointValue = string.Format("X: {0,2:F4} \nY: {1,2:F4}", point.X, point.Y); 

?

Should output:

 X: 02,5354 Y: 12,1234 

In general, it is better to throw at this trace value ...