Hi all,
In my project I have a control (described in an earlier post) which
basically consists of three "subcontrols": One big area where the vital
data is displayed (scrollable, since it will usually be larger than the
window containing the parent control), a time strip on top of it, and a
resource list on the left. Long story short - when someone scrolls the
scrollable data control, the time strip and resource lists are hooked to
keep up and update themselves.
I used to have the time strip and resource list as scrollable controls
as well, and then just scroll their position along when the main data
control was scrolled. The downside to this - while resizing, the
scrollbars would flash on and off constantly, even if I did a
SuspendLayout() / ResumeLayout() around the resize process.
So I decided to try out another way; The time strip is very simple
(basically just a few lines on the hour, half hour and 15/45 minute
marks, plus a text indicating the time on the hour marks) so I thought
it should be able to keep up - when the main control is scrolled, the
time strip is told what time it is scrolled to, then the control
repaints itself. This works;
However, if I scroll horizontally faster than.. well, painfully slow,
the time strip takes a break, and does not update until I slow down or
stop. The repainting of the main data control is a LOT more complex than
the time strip, so I would actually not think that there would be a
problem keeping up. However, as it is now, the approach with scrolling
another scrollable control in sync with the main one was a lot smoother.
I set all controls to be DoubleBuffer|UserPaint|AllPaintingInWmPaint, btw.
What can I do to ensure that the time strip keeps up? Should I somehow
detect that a new scroll position has been sent inside my paint routine,
so that it aborts the current paint and starts a new one?
Any insights on this would be highly appreciated!
Thanks!
Rune