Scrolling an InkCollector

Posted on January 31, 2006 // 0 Comments

As I mentioned elsewhere, I’m working on a DXCore plugin to enable (Tablet PC) ink drawing on the Visual Studio editor surface. A problem I stumbled upon in this regard was the scrolling functionality. Generally this is really easy to implement, using a transformation with the ink renderer. So I had this method:

After wondering for a while why this didn’t work, I put in some logging and found that the value passed in as -p.Y was actually growing for every call into that method, regardless how I was dragging the vertical scrollbar. The explanation was simple in the end, as these explanations tend to be: the PixelToInkSpace method takes any current transformations into account, so that any calculation is relative to an origin set earlier – in the last update, in fact. So the solution was to use an offset for the calculation and everything started working: