I've found a satisfactory solution. I found out the horizontalScrollBar->maximum changes with each successive paint event. I can calculate what the maximum should be and then determine which is the last paint event.