Charles Petzold

Floating Point: The Final Victory

Happy Winter Solstice!
from Roscoe, NY

We've seen it coming for a long time, but it's worth pointing out that the programming interface to the Windows Presentation Foundation graphics system is entirely double-precision floating point with nary an integer to be found.

What's more, the windowing system is laden with doubles as well. The decision to go to a uniform device-independent coordinate system of 96 units to the inch required everything else to be expressed in floating point, including control dimensions and mouse positions.

It's hard to believe that you couldn't even use floating point in Windows 1.0.

Where I did not expect to find floating point, however, was in scrollbars. But there it is: All the numeric ScrollBar properties — Value, Minimum, Maximum, SmallChange, and LargeChange — are doubles.

Trouble is, I only discovered this when I tried to bind Label content to the scrollbar Value property, as shown in the stripped-down ScrollBarWithBinding.xaml. Everything was cool when I clicked the thing, but then I grabbed the thumb and all sorts of crazy numbers spilled out. What if I don't want to see all that detail?