469,643 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Mysterious vScrollbar.Value update timing, can anyone shed light?

Hi all,
WINDOWS.FORMS.SCROLLBAR COMPONENT...[to avoid confusion, "REAL" scrollbars,
not subcomponents of an autoscrolling container]

quick apology for my sorry posterior if posting in wrong place -- haven't
much experience with these groups, and can find nothing more specific than

my program manually sets up some synchronization between the user's mouse
[home-made mouse dragging code], some bitmaps viewable on container's surface
(panel, it happens), and two scrollbars that move in concert

Since scrollBars practically "live" just to constantly shift through X,Y
planar data, i'm attempting to read data from the bars.Value property in my
MouseMove handler -- when the scrollbar values reach the ends of their
ranges, its an accurate, simple (but indirect) indicator that's useful for
controlling my app simulation's behavior..

There is no problem reading the various scrollbar property data values, BUT,
these do not appear time synchronized with the mouse movements [or with
realtime, the mouse seems to report coordinates 'now' or thereabouts,
scrollbars at their convenience, typically, 'later') (data is always
correct, eventually, but i get the mouse data significantly before the .value
of the scrollbar catches up. [I am basing my assertion that the scrolls
update inefficiently partly on the observation that WHEN I MOVE THE MOUSE
VERY SLOWLY, the scrollbar.value and mouse coords recieved in mouseMove
behave as i expect, (map/demonstrate time and data synchronization). But if
i go too fast, the .value property lags, and i get my mousemove message with
"go go, zoom zoom" info before the "no, no, edge of cliff just ahead info],
and my images careen off the edge of the panel! But its quite possible that
i don't even have this much right, -- interestingly, this hack "solves" the
problem, [very, very bad code, do not emulate, not useable, hardware

private void viewWindow_MouseMove( object sender, MouseEventArgs e )
if ( !bVWDragging )
int changeY = e.Y - oldVWMouse.Y;

// INTENTIONALLY 'HOBBLE' MOUSE to speed limit = 16 pixels per

if ( Math.Abs( changeY ) > 16 )
if ( changeY > 0 ) changeY = 16; else changeY = -16;

if ( vScrollBar1.Visible == true )
if ( changeY > 0 && vScrollBar1.Value > vScrollBar1.Minimum )

// hobble mouse even MORE SEVERELY if getting near Minimum
// (the point we are tracking and desire timely info about)
if ( vScrollBar1.Value < 16 )
changeY = 1;

[Ultimately I probably "should" obtain the position data i need directly
from the elements i am trying to control, rather than indirectly as above,
but there can be many of them, arranged arbitrarily, and the scrolls are very
appetizing because all the DO is contain the information i want! But i seem
to recall scrapping over sharp shoals any time in the past i've tried to do
anything aside from passively responding to scrollbar event handlers and
repositioning stuff accordingly --scrolls seem to be unreliable instrument
for obtaining this kind of indirect reading. Anyway, would much appreciate
any info related here, problem is nasty and would like to learn my lesson
once and fall all on this. One, probably wrong quess is that there may be an
unprocessed queue of messages from the scrollBars in the panel's message
queue, but my computer is shiny new and therefore quite fast machine, and
it's hard to believe that it can't keep up with the movements of the mouse,
-- my wrist action is pretty powerful, but i'm not hearing sonic booms or
observing relativistic contractions of spacetime down there in the vicinity
of my mousepad!
Mar 22 '06 #1
0 1145

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jordan Peterson | last post: by
16 posts views Thread by Philip Boonzaaier | last post: by
1 post views Thread by Dmitri Shvetsov | last post: by
reply views Thread by bleedledeep | last post: by
3 posts views Thread by Alfonzo Morra | last post: by
reply views Thread by Paul W | last post: by
1 post views Thread by eBob.com | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.